Package org.openscience.cdk.layout
Class RingPlacer
java.lang.Object
org.openscience.cdk.layout.RingPlacer
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTrue if coordinates have been assigned to all atoms in all rings.voidWalks throught the atoms of each ring in a ring set and marks a ring as PLACED if all of its atoms have been placed.doublegetNativeRingRadius(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.voidpartitionNonRingPartners(IAtom atom, IRing ring, IAtomContainer ringAtoms, IAtomContainer nonRingAtoms) Partition the bonding partners of a given atom into ring atoms and non-ring atomsvoidplaceFusedRing(IRing ring, IAtomContainer sharedAtoms, javax.vecmath.Vector2d ringCenterVector, double bondLength) Generated coordinates for a given ring, which is fused to another ring.voidPlace ring with default start angles, usingdefaultAngles.voidplaceRing(IRing ring, javax.vecmath.Point2d ringCenter, double bondLength, Map<Integer, Double> startAngles) Place ring with user provided angles.voidplaceRing(IRing ring, IAtomContainer sharedAtoms, javax.vecmath.Point2d sharedAtomsCenter, javax.vecmath.Vector2d ringCenterVector, double bondLength) Generated coordinates for a given ring.placeRingSubstituents(IRingSet rs, double bondLength) Positions the aliphatic substituents of a ring systemvoidplaceSpiroRing(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.voidsetAtomPlacer(AtomPlacer atomPlacer) voidsetMolecule(IAtomContainer molecule)
-
Field Details
-
RAD_30
public static final double RAD_30 -
defaultAngles
Default ring start angles. Map contains pairs: ring size with start angle. -
jcpAngles
Suggested ring start angles for JChempaint, different due to Y inversion of canvas.
-
-
Constructor Details
-
RingPlacer
public RingPlacer()The empty constructor.
-
-
Method Details
-
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 placedsharedAtoms- The atoms of this ring, also members of another ring, which are already placedsharedAtomsCenter- The geometric center of these atomsringCenterVector- A vector pointing the the center of the new ringbondLength- The standard bondlength
-
placeRing
Place ring with default start angles, usingdefaultAngles.- 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
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 placedsharedAtoms- The atoms of this ring, also members of another ring, which are already placedsharedAtomsCenter- The geometric center of these atomsringCenterVector- A vector pointing the the center of the new ringbondLength- 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 placedsharedAtoms- The atoms of this ring, also members of another ring, which are already placedringCenterVector- A vector pointing the the center of the new ringbondLength- The standard bondlength
-
allPlaced
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
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 partitionedring- The ring against which the bonding partners are checkedringAtoms- An AtomContainer to store the ring bonding partnersnonRingAtoms- An AtomContainer to store the non-ring bonding partners
-
getNativeRingRadius
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 calculatedbondLength- The bond length for each bond in the ring- Returns:
- The radius of the ring.
-
getMolecule
-
setMolecule
-
getAtomPlacer
-
setAtomPlacer
-