public class StructureDiagramGenerator extends Object
StructureDiagramGenerator sdg = new StructureDiagramGenerator(); sdg.setMolecule(someMolecule); sdg.generateCoordinates(); Molecule layedOutMol = sdg.getMolecule();
The method will fail if the molecule is disconnected. The partitionIntoMolecules(AtomContainer) can help here.
ConnectivityChecker.partitionIntoMolecules(IAtomContainer)
Constructor and Description |
---|
StructureDiagramGenerator()
The empty constructor.
|
StructureDiagramGenerator(IMolecule molecule)
Creates an instance of this class while assigning a molecule to be layed
out.
|
Modifier and Type | Method and Description |
---|---|
void |
generateCoordinates()
The main method of this StructurDiagramGenerator.
|
void |
generateCoordinates(javax.vecmath.Vector2d firstBondVector)
The main method of this StructurDiagramGenerator.
|
void |
generateExperimentalCoordinates()
This method uses generateCoordinates, but it removes the hydrogens first,
lays out the structuren and then adds them again.
|
void |
generateExperimentalCoordinates(javax.vecmath.Vector2d firstBondVector)
Generates 2D coordinates on the non-hydrogen skeleton, after which
coordinates for the hydrogens are calculated.
|
double |
getBondLength()
Returns the bond length used for laying out the molecule.
|
IMolecule |
getMolecule()
Returns the molecule, usually used after a call of generateCoordinates()
|
IAtom |
getOtherBondAtom(IAtom atom,
IBond bond)
Returns the other atom of the bond.
|
TemplateHandler |
getTemplateHandler()
Gets the templateHandler attribute of the StructureDiagramGenerator object
|
boolean |
getUseTemplates()
Returns whether the use of templates is enabled or disabled.
|
void |
setBondLength(double bondLength)
Set the bond length used for laying out the molecule.
|
void |
setMolecule(IMolecule molecule)
Assings a molecule to be layed out.
|
void |
setMolecule(IMolecule mol,
boolean clone)
Assings a molecule to be layed out.
|
void |
setTemplateHandler(TemplateHandler templateHandler)
Sets the templateHandler attribute of the StructureDiagramGenerator object
|
void |
setUseTemplates(boolean useTemplates)
Sets whether to use templates or not.
|
public StructureDiagramGenerator()
public StructureDiagramGenerator(IMolecule molecule)
molecule
- The molecule to be layed out.public void setMolecule(IMolecule mol, boolean clone)
mol
- the molecule for which coordinates are to be generated.clone
- Should the whole process be performed with a cloned copy?public void setUseTemplates(boolean useTemplates)
useTemplates
- set true to use templates, false otherwisepublic boolean getUseTemplates()
public void setTemplateHandler(TemplateHandler templateHandler)
templateHandler
- The new templateHandler valuepublic TemplateHandler getTemplateHandler()
public void setMolecule(IMolecule molecule)
molecule
- the molecule for which coordinates are to be generated.public IMolecule getMolecule()
public void generateExperimentalCoordinates() throws CDKException
CDKException
- if an error occursgenerateCoordinates(javax.vecmath.Vector2d)
public void generateExperimentalCoordinates(javax.vecmath.Vector2d firstBondVector) throws CDKException
firstBondVector
- the vector of the first bond to lay outCDKException
- if an error occurspublic void generateCoordinates(javax.vecmath.Vector2d firstBondVector) throws CDKException
firstBondVector
- The vector of the first bond to lay outCDKException
- if an error occurspublic void generateCoordinates() throws CDKException
CDKException
- if an error occurspublic void setBondLength(double bondLength)
bondLength
- The new bondLength valuepublic double getBondLength()