Class BasicBondGenerator

    • Field Detail

      • ringSet

        protected IRingSet ringSet
        Necessary for calculating inner-ring bond elements.
    • Constructor Detail

      • BasicBondGenerator

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

      • setOverrideColor

        public void setOverrideColor​(Color color)
        Set the color to use for all bonds, overriding the standard bond colors.
        Parameters:
        color - the override color
      • setOverrideBondWidth

        public void setOverrideBondWidth​(double bondWidth)
        Set the width to use for all bonds, overriding any standard bond widths.
        Parameters:
        bondWidth -
      • getRingSet

        protected IRingSet getRingSet​(IAtomContainer atomContainer)
        Determine the ring set for this atom container.
        Parameters:
        atomContainer - the atom container to find rings in.
        Returns:
        the rings of the molecule
      • getColorForBond

        public Color getColorForBond​(IBond bond,
                                     RendererModel model)
        Determine the color of a bond, returning either the default color, the override color or whatever is in the color hash for that bond.
        Parameters:
        bond - the bond we are generating an element for
        model - the rendering model
        Returns:
        the color to paint the bond
      • getWidthForBond

        public double getWidthForBond​(IBond bond,
                                      RendererModel model)
        Determine the width of a bond, returning either the width defined in the model, or the override width. Note that this will be scaled to the space of the model.
        Parameters:
        bond - the bond to determine the width for
        model - the renderer model
        Returns:
        a double in chem-model space
      • generate

        public IRenderingElement generate​(IBond currentBond,
                                          RendererModel model)
        Generate rendering element(s) for the current bond, including ring elements if this bond is part of a ring.
        Parameters:
        currentBond - the bond to use when generating elements
        model - the renderer model
        Returns:
        one or more rendering elements
      • generateBondElement

        public IRenderingElement generateBondElement​(IBond bond,
                                                     RendererModel model)
        Generate rendering elements for a bond, without ring elements but considering the type of the bond (single, double, triple).
        Parameters:
        bond - the bond to use when generating elements
        model - the renderer model
        Returns:
        one or more rendering elements
      • generateBondElement

        public IRenderingElement generateBondElement​(IBond bond,
                                                     IBond.Order type,
                                                     RendererModel model)
        Generate a LineElement or an ElementGroup of LineElements for this bond. This version should be used if you want to override the type - for example, for ring double bonds.
        Parameters:
        bond - the bond to generate for
        type - the type of the bond - single, double, etc
        model - the renderer model
        Returns:
        one or more rendering elements
      • generateRingElements

        public IRenderingElement generateRingElements​(IBond bond,
                                                      IRing ring,
                                                      RendererModel model)
        Generate ring elements, such as inner-ring bonds or ring stereo elements.
        Parameters:
        bond - the ring bond to use when generating elements
        ring - the ring that the bond is in
        model - the renderer model
        Returns:
        one or more rendering elements
      • generateInnerElement

        public LineElement generateInnerElement​(IBond bond,
                                                IRing ring,
                                                RendererModel model)
        Make the inner ring bond, which is slightly shorter than the outer bond.
        Parameters:
        bond - the ring bond
        ring - the ring that the bond is in
        model - the renderer model
        Returns:
        the line element
      • bindsHydrogen

        protected boolean bindsHydrogen​(IBond bond)
        Check to see if any of the atoms in this bond are hydrogen atoms.
        Parameters:
        bond - the bond to check
        Returns:
        true if any atom has an element symbol of "H"
      • generateBond

        public IRenderingElement generateBond​(IBond bond,
                                              RendererModel model)
        Generate stereo or bond elements for this bond.
        Parameters:
        bond - the bond to use when generating elements
        model - the renderer model
        Returns:
        one or more rendering elements