GChemPaint molecule class.
More...
#include <gcp/molecule.h>
List of all members.
Detailed Description
GChemPaint molecule class.
Definition at line 45 of file gcp/molecule.h.
Constructor & Destructor Documentation
gcp::Molecule::Molecule |
( |
gcu::TypeId |
Type = gcu::MoleculeType | ) |
|
The default constructor. Builds a new empty molecule.
gcp::Molecule::Molecule |
( |
Atom * |
pAtom | ) |
|
- Parameters:
-
Constructs a new molecule containing pAtom and all atoms which might be bonded to it, and the corresponding bonds.
virtual gcp::Molecule::~Molecule |
( |
| ) |
[virtual] |
Member Function Documentation
void gcp::Molecule::AddAtom |
( |
gcu::Atom * |
pAtom | ) |
|
- Parameters:
-
Adds an atom to the molecule.
void gcp::Molecule::AddBond |
( |
gcu::Bond * |
pBond | ) |
|
- Parameters:
-
Adds a bond to the molecule.
- Parameters:
-
object | the object to add to the molecule. |
Adds an object (atom, bond, or fragment) to the molecule.
void gcp::Molecule::AddFragment |
( |
Fragment * |
pFragment | ) |
|
- Parameters:
-
Adds a fragment to the molecule.
bool gcp::Molecule::BuildContextualMenu |
( |
gcu::UIManager * |
UIManager, |
|
|
gcu::Object * |
object, |
|
|
double |
x, |
|
|
double |
y |
|
) |
| |
- Parameters:
-
UIManager | the gcu::UIManager to populate. |
object | the Object on which occured the mouse click. |
x | x coordinate of the mouse click. |
y | y coordinate of the mouse click. |
This method is called to build the contextual menu for the molecule.
- Returns:
- true if something is added to the UIManager, false otherwise.
void gcp::Molecule::CheckCrossings |
( |
Bond * |
pBond | ) |
|
- Parameters:
-
pBond | a bond in the molecule. |
Checks if any other bond in the molecule crosses pBond, and notify both bonds that they are crossing.
void gcp::Molecule::Clear |
( |
| ) |
|
Removes all children from the molecule, resulting in a empty molecule.
std::string gcp::Molecule::GetAlignmentId |
( |
| ) |
[inline] |
Object* gcp::Molecule::GetAtomAt |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
z = 0. |
|
) |
| |
- Parameters:
-
x | the x coordinate |
y | the y coordinate |
z | the z coordinate (not used) |
- Returns:
- a pointer to n atom at or near position defined by the coordinates passed as parameters or NULL if none is found in the molecule.
unsigned gcp::Molecule::GetAtomsNumber |
( |
| ) |
const |
- Returns:
- the number of atoms in the molecule. Atoms groups are counted for one only, whatever their real atomic composition.
std::string gcp::Molecule::GetRawFormula |
( |
| ) |
const |
- Returns:
- the raw formula as a string. Molecules with fragments are not currently supported.
double gcp::Molecule::GetYAlign |
( |
| ) |
|
Used to retrieve the y coordinate for alignment.
- Returns:
- y coordinate used for the molecule alignment.
bool gcp::Molecule::Load |
( |
xmlNodePtr |
node | ) |
|
- Parameters:
-
node | a pointer to the xmlNode containing the serialized molecule. |
Used to load a molecule in memory. The Mlecule instance must already exist.
- Returns:
- true on succes, false otherwise.
bool gcp::Molecule::Merge |
( |
Molecule * |
pMolecule, |
|
|
bool |
RemoveDuplicates = false |
|
) |
| |
- Parameters:
-
pMolecule | a molecule. |
RemoveDuplicates | whether duplicate atoms should be unififed or not. |
Adds all children from pMolecule in this instance, and removes one of the atoms for each pair of duplicates (atoms with same atomic number and position) if RemoveDuplicates is true. This might fail when it would end with hypervalent atoms. On success pMolecule is deleted.
- Returns:
- true on success, false otherwise.
void gcp::Molecule::OnLoaded |
( |
| ) |
|
Updates all cycles after loading.
- Parameters:
-
Signal | the appropriate SignalId |
Child | the child which emitted the signal or NULL |
Signals the molecule that at least one of its children changed.
- Returns:
- true to propagate the signal to the parent.
void gcp::Molecule::OpenCalc |
( |
| ) |
|
Opens GChemCalc with the formula for the molecule. Molecules with fragments are not currently supported.
- Parameters:
-
pObject | an atom, a bond, or a fragment in the molecule. |
Removes an atom, a bond, or a fragment from a molecule.
xmlNodePtr gcp::Molecule::Save |
( |
xmlDocPtr |
xml | ) |
const |
- Parameters:
-
xml | the xmlDoc used to save the document. |
Used to save the molecule to the xmlDoc.
- Returns:
- the xmlNode containing the serialized molecule.
void gcp::Molecule::SelectAlignmentItem |
( |
gcu::Object * |
child | ) |
|
- Parameters:
-
child | the child used for alignment. |
Selects the child used for alignment, which might be an atom or group of atoms, or a bond. For bonds, the center of the bonds is used, a while for the others a call to their gcu::Object::GetYAlign() method will be used.
void gcp::Molecule::Transform2D |
( |
gcu::Matrix2D & |
m, |
|
|
double |
x, |
|
|
double |
y |
|
) |
| |
- Parameters:
-
m | the Matrix2D of the transformation. |
x | the x component of the center of the transformation. |
y | the y component of the center of the transformation. |
Used to move and/or transform the molecule taking care of hydrogen atoms positions around heteroatoms.
The documentation for this class was generated from the following file: