Class RingPlacer


  • public class RingPlacer
    extends Object
    Class providing methods for generating coordinates for ring atoms. Various situations are supported, like condensation, spiro-attachment, etc. They can be used for Automated Structure Diagram Generation or in the interactive buildup of ringsystems by the user.
    Source code:
    main
    Belongs to CDK module:
    sdg
    • Field Detail

      • RAD_30

        public static final double RAD_30
      • defaultAngles

        public static final Map<Integer,​Double> defaultAngles
        Default ring start angles. Map contains pairs: ring size with start angle.
      • jcpAngles

        public static final Map<Integer,​Double> jcpAngles
        Suggested ring start angles for JChempaint, different due to Y inversion of canvas.
    • Constructor Detail

      • RingPlacer

        public RingPlacer()
        The empty constructor.
    • Method Detail

      • placeRing

        public void placeRing​(IRing ring,
                              IAtomContainer sharedAtoms,
                              javax.vecmath.Point2d sharedAtomsCenter,
                              javax.vecmath.Vector2d ringCenterVector,
                              double bondLength)
        Generated coordinates for a given ring. Multiplexes to special handlers for the different possible situations (spiro-, fusion-, bridged attachement)
        Parameters:
        ring - The ring to be placed
        sharedAtoms - The atoms of this ring, also members of another ring, which are already placed
        sharedAtomsCenter - The geometric center of these atoms
        ringCenterVector - A vector pointing the the center of the new ring
        bondLength - The standard bondlength
      • placeRing

        public void placeRing​(IRing ring,
                              javax.vecmath.Point2d ringCenter,
                              double bondLength)
        Place ring with default start angles, using defaultAngles.
        Parameters:
        ring - the ring to place.
        ringCenter - center coordinates of the ring.
        bondLength - given bond length.
      • placeRing

        public void placeRing​(IRing ring,
                              javax.vecmath.Point2d ringCenter,
                              double bondLength,
                              Map<Integer,​Double> startAngles)
        Place ring with user provided angles.
        Parameters:
        ring - the ring to place.
        ringCenter - center coordinates of the ring.
        bondLength - given bond length.
        startAngles - a map with start angles when drawing the ring.
      • placeRingSubstituents

        public IAtomContainer placeRingSubstituents​(IRingSet rs,
                                                    double bondLength)
        Positions the aliphatic substituents of a ring system
        Parameters:
        rs - The RingSystem for which the substituents are to be laid out
        Returns:
        A list of atoms that where laid out
      • placeSpiroRing

        public void placeSpiroRing​(IRing ring,
                                   IAtomContainer sharedAtoms,
                                   javax.vecmath.Point2d sharedAtomsCenter,
                                   javax.vecmath.Vector2d ringCenterVector,
                                   double bondLength)
        Generated coordinates for a given ring, which is connected to a spiro ring. The rings share exactly one atom.
        Parameters:
        ring - The ring to be placed
        sharedAtoms - The atoms of this ring, also members of another ring, which are already placed
        sharedAtomsCenter - The geometric center of these atoms
        ringCenterVector - A vector pointing the the center of the new ring
        bondLength - The standard bondlength
      • placeFusedRing

        public void placeFusedRing​(IRing ring,
                                   IAtomContainer sharedAtoms,
                                   javax.vecmath.Vector2d ringCenterVector,
                                   double bondLength)
        Generated coordinates for a given ring, which is fused to another ring. The rings share exactly one bond.
        Parameters:
        ring - The ring to be placed
        sharedAtoms - The atoms of this ring, also members of another ring, which are already placed
        ringCenterVector - A vector pointing the the center of the new ring
        bondLength - The standard bondlength
      • allPlaced

        public boolean allPlaced​(IRingSet rs)
        True if coordinates have been assigned to all atoms in all rings.
        Parameters:
        rs - The ringset to be checked
        Returns:
        True if coordinates have been assigned to all atoms in all rings.
      • checkAndMarkPlaced

        public void checkAndMarkPlaced​(IRingSet rs)
        Walks throught the atoms of each ring in a ring set and marks a ring as PLACED if all of its atoms have been placed.
        Parameters:
        rs - The ringset to be checked
      • partitionNonRingPartners

        public void partitionNonRingPartners​(IAtom atom,
                                             IRing ring,
                                             IAtomContainer ringAtoms,
                                             IAtomContainer nonRingAtoms)
        Partition the bonding partners of a given atom into ring atoms and non-ring atoms
        Parameters:
        atom - The atom whose bonding partners are to be partitioned
        ring - The ring against which the bonding partners are checked
        ringAtoms - An AtomContainer to store the ring bonding partners
        nonRingAtoms - An AtomContainer to store the non-ring bonding partners
      • getNativeRingRadius

        public double getNativeRingRadius​(IRing ring,
                                          double bondLength)
        Returns the ring radius of a perfect polygons of size ring.getAtomCount() The ring radius is the distance of each atom to the ringcenter.
        Parameters:
        ring - The ring for which the radius is to calculated
        bondLength - The bond length for each bond in the ring
        Returns:
        The radius of the ring.
      • getAtomPlacer

        public AtomPlacer getAtomPlacer()
      • setAtomPlacer

        public void setAtomPlacer​(AtomPlacer atomPlacer)