Class StandardGenerator

All Implemented Interfaces:

public final class StandardGenerator extends Object implements IGenerator<IAtomContainer>
The standard generator creates IRenderingElements 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.
John May
See Also:
  • Field Details


      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 with SymbolVisibility.
       atom.setProperty(StandardGenerator.HIGHLIGHT_COLOR, Color.RED);
      See Also:

      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:

      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";
                        StandardGenerator.ITALIC_DISPLAY_PREFIX + cipLabel);
      See Also:
    • 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:

      public static final String HIDDEN_FULLY
      See Also:
  • Constructor Details

    • StandardGenerator

      public StandardGenerator(Font font)
      Create a new standard generator that utilises the specified font to display atom symbols.
      font - the font family, size, and style
  • Method Details

    • generate

      public IRenderingElement generate(IAtomContainer container, RendererModel parameters)
      Converts a IChemObject from the chemical data model into something that can be drawn in the chemical drawing.
      Specified by:
      generate in interface IGenerator<IAtomContainer>
      container - the chemical entity to be depicted
      parameters - the rendering parameters
      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.
      font - the font to embedded
      text - the text label
      color - the color
      scale - the resize, should include the model scale
      pre-rendered element
    • getParameters

      public List<IGeneratorParameter<?>> getParameters()
      Returns the list of IGeneratorParameter for this particular generator.
      Specified by:
      getParameters in interface IGenerator<IAtomContainer>
      a List of IGeneratorParameters