@TestClass(value="org.openscience.cdk.layout.AtomPlacerTest") public class AtomPlacer extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
debug |
Constructor and Description |
---|
AtomPlacer()
Constructor for the AtomPlacer object
|
Modifier and Type | Method and Description |
---|---|
boolean |
allPlaced(IAtomContainer ac)
True is all the atoms in the given AtomContainer have been placed
|
void |
breadthFirstSearch(IAtomContainer ac,
Vector sphere,
IAtomContainer[] pathes)
Performs a breadthFirstSearch in an AtomContainer starting with a
particular sphere, which usually consists of one start atom, and searches
for the longest aliphatic chain which is yet unplaced.
|
void |
distributePartners(IAtom atom,
IAtomContainer placedNeighbours,
javax.vecmath.Point2d sharedAtomsCenter,
IAtomContainer unplacedNeighbours,
double bondLength)
Distribute the bonded atoms (neighbours) of an atom such that they fill the
remaining space around an atom in a geometrically nice way.
|
IAtomContainer |
getInitialLongestChain(IMolecule molecule)
Search an aliphatic molecule for the longest chain.
|
IAtomContainer |
getLongestUnplacedChain(IMolecule molecule,
IAtom startAtom)
Search a molecule for the longest unplaced, aliphatic chain in it.
|
IAtomContainer |
getMolecule()
Return the molecule the AtomPlacer currently works with
|
javax.vecmath.Vector2d |
getNextBondVector(IAtom atom,
IAtom previousAtom,
javax.vecmath.Point2d distanceMeasure,
boolean trans)
Returns the next bond vector needed for drawing an extended linear chain of
atoms.
|
IAtomContainer |
getPlacedAtoms(IAtomContainer ac)
Get all the placed atoms in an AtomContainer
|
String |
listNumbers(IAtomContainer mol,
IAtomContainer ac)
Returns a string with the numbers of all atoms in an AtomContainer relative
to a given molecule.
|
String |
listNumbers(IAtomContainer mol,
Vector ac)
Returns a string with the numbers of all atoms in a Vector relative to a
given molecule.
|
String |
listPlaced(IAtomContainer ac)
Returns a string with the numbers of all placed atoms in an AtomContainer
|
void |
markNotPlaced(IAtomContainer ac)
Marks all the atoms in the given AtomContainer as not placed
|
void |
markPlaced(IAtomContainer ac)
Marks all the atoms in the given AtomContainer as placed
|
void |
partitionPartners(IAtom atom,
IAtomContainer unplacedPartners,
IAtomContainer placedPartners)
Partition the bonding partners of a given atom into placed (coordinates
assinged) and not placed.
|
void |
placeLinearChain(IAtomContainer atomContainer,
javax.vecmath.Vector2d initialBondVector,
double bondLength)
Places the atoms in a linear chain.
|
void |
populatePolygonCorners(List<IAtom> atomsToDraw,
javax.vecmath.Point2d rotationCenter,
double startAngle,
double addAngle,
double radius)
Populates the corners of a polygon with atoms.
|
void |
setMolecule(IAtomContainer molecule)
Sets the molecule the AtomPlacer currently works with
|
boolean |
shouldBeLinear(IAtom atom,
IAtomContainer molecule) |
public static final boolean debug
@TestMethod(value="emptyAtomsListTest,triangleTest") public AtomPlacer()
public IAtomContainer getMolecule()
public void setMolecule(IAtomContainer molecule)
molecule
- the molecule the AtomPlacer currently works withpublic void distributePartners(IAtom atom, IAtomContainer placedNeighbours, javax.vecmath.Point2d sharedAtomsCenter, IAtomContainer unplacedNeighbours, double bondLength)
atom
- The atom whose partners are to be placedplacedNeighbours
- The atoms which are already placedunplacedNeighbours
- The partners to be placedbondLength
- The standared bond length for the newly placed
AtomssharedAtomsCenter
- The 2D centre of the placed Atomspublic void placeLinearChain(IAtomContainer atomContainer, javax.vecmath.Vector2d initialBondVector, double bondLength)
Expects the first atom to be placed and places the next atom according to initialBondVector. The rest of the chain is placed such that it is as linear as possible (in the overall result, the angles in the chain are set to 120 Deg.)
atomContainer
- The IAtomContainer containing the chain atom to be placedinitialBondVector
- The Vector indicating the direction of the first bondbondLength
- The factor used to scale the initialBondVectorpublic javax.vecmath.Vector2d getNextBondVector(IAtom atom, IAtom previousAtom, javax.vecmath.Point2d distanceMeasure, boolean trans)
atom
- An atom for which the vector to the next atom to
draw is calculatedpreviousAtom
- The preceding atom for angle calculationdistanceMeasure
- A point from which the next atom is to be farmost
awaytrans
- if true E (trans) configurations are built, false makes Z (cis) configurations@TestMethod(value="emptyAtomsListTest,triangleTest") public void populatePolygonCorners(List<IAtom> atomsToDraw, javax.vecmath.Point2d rotationCenter, double startAngle, double addAngle, double radius)
atomsToDraw
- All the atoms to drawstartAngle
- A start angle, giving the angle of the most clockwise
atom which has already been placedaddAngle
- An angle to be added to startAngle for each atom from
atomsToDrawrotationCenter
- The center of a ring, or an atom for which the
partners are to be placedradius
- The radius of the polygon to be populated: bond
length or ring radiuspublic void partitionPartners(IAtom atom, IAtomContainer unplacedPartners, IAtomContainer placedPartners)
atom
- The atom whose bonding partners are to be
partitionedunplacedPartners
- A vector for the unplaced bonding partners to go inplacedPartners
- A vector for the placed bonding partners to go inpublic IAtomContainer getInitialLongestChain(IMolecule molecule) throws CDKException
molecule
- The molecule
to be search for the longest unplaced chainNoSuchAtomException
- Description of
the ExceptionCDKException
public IAtomContainer getLongestUnplacedChain(IMolecule molecule, IAtom startAtom) throws CDKException
molecule
- The molecule to be
search for the longest unplaced chainstartAtom
- A start atom from
which the chain search startsCDKException
- Description of the
Exceptionpublic void breadthFirstSearch(IAtomContainer ac, Vector sphere, IAtomContainer[] pathes) throws CDKException
ac
- The AtomContainer to
be searchedsphere
- A sphere of atoms to
start the search withpathes
- A vector of N pathes
(N = no of heavy atoms).CDKException
- Description of the
Exceptionpublic String listPlaced(IAtomContainer ac)
ac
- The AtomContainer for which the placed atoms are to be listedpublic String listNumbers(IAtomContainer mol, IAtomContainer ac) throws CDKException
ac
- The AtomContainer for
which the placed atoms are to be listedmol
- Description of the
ParameterCDKException
- Description of the
Exceptionpublic String listNumbers(IAtomContainer mol, Vector ac) throws Exception
ac
- The Vector for which the placed atoms are to
be listedmol
- Description of the ParameterException
- Description of the Exceptionpublic boolean allPlaced(IAtomContainer ac)
ac
- The AtomContainer to be searchedpublic void markNotPlaced(IAtomContainer ac)
ac
- The AtomContainer whose atoms are to be markedpublic void markPlaced(IAtomContainer ac)
ac
- The AtomContainer whose atoms are to be markedpublic IAtomContainer getPlacedAtoms(IAtomContainer ac)
ac
- The AtomContainer to be searched for placed atomspublic boolean shouldBeLinear(IAtom atom, IAtomContainer molecule)