Class BasicAtomGenerator

    • Constructor Detail

      • BasicAtomGenerator

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

      • 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.