Package org.openscience.cdk.layout
Class RingPlacer
- java.lang.Object
-
- org.openscience.cdk.layout.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
-
-
Constructor Summary
Constructors Constructor Description RingPlacer()
The empty constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allPlaced(IRingSet rs)
True if coordinates have been assigned to all atoms in all rings.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.AtomPlacer
getAtomPlacer()
IAtomContainer
getMolecule()
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.void
partitionNonRingPartners(IAtom atom, IRing ring, IAtomContainer ringAtoms, IAtomContainer nonRingAtoms)
Partition the bonding partners of a given atom into ring atoms and non-ring atomsvoid
placeFusedRing(IRing ring, IAtomContainer sharedAtoms, javax.vecmath.Vector2d ringCenterVector, double bondLength)
Generated coordinates for a given ring, which is fused to another ring.void
placeRing(IRing ring, javax.vecmath.Point2d ringCenter, double bondLength)
Place ring with default start angles, usingdefaultAngles
.void
placeRing(IRing ring, javax.vecmath.Point2d ringCenter, double bondLength, Map<Integer,Double> startAngles)
Place ring with user provided angles.void
placeRing(IRing ring, IAtomContainer sharedAtoms, javax.vecmath.Point2d sharedAtomsCenter, javax.vecmath.Vector2d ringCenterVector, double bondLength)
Generated coordinates for a given ring.IAtomContainer
placeRingSubstituents(IRingSet rs, double bondLength)
Positions the aliphatic substituents of a ring systemvoid
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.void
setAtomPlacer(AtomPlacer atomPlacer)
void
setMolecule(IAtomContainer molecule)
-
-
-
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 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
public void placeRing(IRing ring, javax.vecmath.Point2d ringCenter, double bondLength)
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
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 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
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 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
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 calculatedbondLength
- The bond length for each bond in the ring- Returns:
- The radius of the ring.
-
getMolecule
public IAtomContainer getMolecule()
-
setMolecule
public void setMolecule(IAtomContainer molecule)
-
getAtomPlacer
public AtomPlacer getAtomPlacer()
-
setAtomPlacer
public void setAtomPlacer(AtomPlacer atomPlacer)
-
-