Class BasicAtomGenerator

java.lang.Object
org.openscience.cdk.renderer.generators.BasicAtomGenerator
All Implemented Interfaces:
IGenerator<IAtomContainer>
Direct Known Subclasses:
AtomMassGenerator, ExtendedAtomGenerator

public class BasicAtomGenerator extends Object implements IGenerator<IAtomContainer>
Generates basic IRenderingElements for atoms in an atom container.
Source code:
main
Belongs to CDK module:
renderbasic
  • Constructor Details

    • BasicAtomGenerator

      public BasicAtomGenerator()
      An empty constructor necessary for reflection.
  • Method Details

    • generate

      public IRenderingElement generate(IAtomContainer container, RendererModel model)
      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>
      Parameters:
      container - the chemical entity to be depicted
      model - the rendering parameters
      Returns:
      a drawable chemical depiction component
    • hasCoordinates

      protected boolean hasCoordinates(IAtom atom)
      Checks an atom to see if it has 2D coordinates.
      Parameters:
      atom - the atom to check
      Returns:
      true if the atom is not null, and it has non-null coordinates
    • isHydrogen

      protected boolean isHydrogen(IAtom atom)
      Determines if the atom is a hydrogen.
      Parameters:
      atom - IAtom to be tested
      Returns:
      true, if the atom is a hydrogen, and false, otherwise.
    • invisibleHydrogen

      protected boolean invisibleHydrogen(IAtom atom, RendererModel model)
      Checks an atom to see if it is an 'invisible hydrogen' - that is, it is a) an (explicit) hydrogen, and b) explicit hydrogens are set to off.
      Parameters:
      atom - the atom to check
      model - the renderer model
      Returns:
      true if this atom should not be shown
    • invisibleCarbon

      protected boolean invisibleCarbon(IAtom atom, IAtomContainer atomContainer, RendererModel model)
      Checks an atom to see if it is an 'invisible carbon' - that is, it is: a) a carbon atom and b) this carbon should not be shown.
      Parameters:
      atom - the atom to check
      atomContainer - the atom container the atom is part of
      model - the renderer model
      Returns:
      true if this atom should not be shown
    • canDraw

      protected boolean canDraw(IAtom atom, IAtomContainer container, RendererModel model)
      Checks an atom to see if it should be drawn. There are three reasons not to draw an atom - a) no coordinates, b) an invisible hydrogen or c) an invisible carbon.
      Parameters:
      atom - the atom to check
      container - the atom container the atom is part of
      model - the renderer model
      Returns:
      true if the atom should be drawn
    • generate

      public IRenderingElement generate(IAtomContainer atomContainer, IAtom atom, RendererModel model)
      Generate the rendering element(s) for a particular atom.
      Parameters:
      atomContainer - the atom container that the atom is from
      atom - the atom to generate the rendering element for
      model - the renderer model
      Returns:
      a rendering element, or group of elements
    • generateCompactElement

      public IRenderingElement generateCompactElement(IAtom atom, RendererModel model)
      Generate a compact element for an atom, such as a circle or a square, rather than text element.
      Parameters:
      atom - the atom to generate the compact element for
      model - the renderer model
      Returns:
      a compact rendering element
    • generateElement

      public AtomSymbolElement generateElement(IAtom atom, int alignment, RendererModel model)
      Generate an atom symbol element.
      Parameters:
      atom - the atom to use
      alignment - the alignment of the atom's label
      model - the renderer model
      Returns:
      an atom symbol element
    • showCarbon

      protected boolean showCarbon(IAtom carbonAtom, IAtomContainer container, RendererModel model)
      Checks a carbon atom to see if it should be shown.
      Parameters:
      carbonAtom - the carbon atom to check
      container - the atom container
      model - the renderer model
      Returns:
      true if the carbon should be shown
    • getAtomColor

      protected Color getAtomColor(IAtom atom, RendererModel model)
      Returns the drawing color of the given atom. An atom is colored as highlighted if highlighted. The atom is color marked if in a substructure. If not, the color from the CDK2DAtomColor is used (if selected). Otherwise, the atom is colored black.
    • getParameters

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