The Gnome Chemistry Utils
0.14.0
|
#include <atom.h>
Public Member Functions | |
Atom () | |
Atom (int Z, double x, double y, double z) | |
virtual | ~Atom () |
virtual void | SetZ (int Z) |
void | AddBond (gcu::Bond *pBond) |
void | RemoveBond (gcu::Bond *pBond) |
virtual void | Update () |
int | GetTotalBondsNumber () const |
int | GetAttachedHydrogens () const |
HPos | GetBestSide () |
virtual gccv::Anchor | GetChargePosition (unsigned char &Pos, double Angle, double &x, double &y) |
virtual int | GetAvailablePosition (double &x, double &y) |
virtual bool | GetRelativePosition (double angle, double &x, double &y) |
virtual bool | GetPosition (double angle, double &x, double &y) |
virtual xmlNodePtr | Save (xmlDocPtr xml) const |
virtual bool | Load (xmlNodePtr node) |
virtual bool | LoadNode (xmlNodePtr node) |
void | AddItem () |
void | SetSelected (int state) |
virtual bool | AcceptNewBonds (int nb=1) |
virtual bool | AcceptCharge (int charge) |
virtual double | GetYAlign () |
virtual void | Move (double x, double y, double z=0.) |
virtual void | Transform2D (gcu::Matrix2D &m, double x, double y) |
bool | BuildContextualMenu (gcu::UIManager *UIManager, Object *object, double x, double y) |
virtual void | AddToMolecule (Molecule *Mol) |
bool | HasImplicitElectronPairs () |
bool | MayHaveImplicitUnpairedElectrons () |
void | AddElectron (Electron *electron) |
void | RemoveElectron (Electron *electron) |
void | NotifyPositionOccupation (unsigned char pos, bool occupied) |
void | SetChargePosition (unsigned char Pos, bool def, double angle=0., double distance=0.) |
char | GetChargePosition (double *Angle, double *Dist) const |
void | SetCharge (int charge) |
int | GetCharge () const |
void | ForceChanged () |
bool | Match (gcu::Atom *atom, gcu::AtomMatchState &state) |
void | GetSymbolGeometry (double &width, double &height, double &angle, bool up) const |
bool | HasAvailableElectrons (bool paired) |
Bond * | GetBondAtAngle (double angle) |
bool | UpdateStereoBonds () |
bool | HasStereoBond () const |
Bond * | GetNewmanBond () const |
void | SetShowSymbol (bool val) |
bool | GetShowSymbol (void) const |
bool & | GetRefShowSymbol (void) |
void | SetHPosStyle (HPos val) |
HPos | GetHPosStyle (void) const |
HPos & | GetRefHPosStyle (void) |
void | SetChargeItem (gccv::Item *val) |
gccv::Item * | GetChargeItem (void) |
void | SetShowCharge (bool val) |
bool | GetShowCharge (void) const |
Public Member Functions inherited from gcu::Atom | |
Atom (Atom &a) | |
Atom & | operator= (Atom &a) |
double | Distance (Atom *pAtom) |
void | zoom (double ZoomFactor) |
bool | GetCoords (double *x, double *y, double *z=NULL) const |
void | SetCoords (double x, double y, double z=0) |
int | GetZ () const |
virtual void | SetCharge (char Charge) |
char | GetCharge () |
virtual const gchar * | GetSymbol () const |
double | x () const |
double | y () const |
double | z () const |
Vector | GetVector () const |
Bond * | GetFirstBond (std::map< Atom *, Bond * >::iterator &i) |
Bond const * | GetFirstBond (std::map< Atom *, Bond * >::const_iterator &i) const |
Bond * | GetNextBond (std::map< Atom *, Bond * >::iterator &i) |
Bond const * | GetNextBond (std::map< Atom *, Bond * >::const_iterator &i) const |
Bond * | GetBond (Atom *pAtom) const |
int | GetBondsNumber () const |
virtual bool | SaveNode (xmlDocPtr xml, xmlNodePtr node) const |
std::string | GetProperty (unsigned property) const |
bool | IsInCycle (Cycle *pCycle) |
std::string | Name () |
void | NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma) |
Public Member Functions inherited from gcu::Object | |
Object (TypeId Id=OtherType) | |
virtual | ~Object () |
TypeId | GetType () const |
void | SetId (gchar const *Id) |
char const * | GetId () const |
virtual void | AddChild (Object *object) |
Object * | GetMolecule () const |
Object * | GetReaction () const |
Object * | GetGroup () const |
Document * | GetDocument () const |
Application * | GetApplication () const |
Object * | GetParentOfType (TypeId Id) const |
Object * | GetChild (const gchar *Id) const |
Object * | GetFirstChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetNextChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetDescendant (const char *Id) const |
Object * | GetParent () const |
void | SetParent (Object *Parent) |
bool | SaveChildren (xmlDocPtr xml, xmlNodePtr node) const |
void | SaveId (xmlNodePtr node) const |
xmlNodePtr | GetNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
xmlNodePtr | GetNextNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
xmlNodePtr | GetNodeByName (xmlNodePtr node, char const *Name) |
xmlNodePtr | GetNextNodeByName (xmlNodePtr node, char const *Name) |
bool | HasChildren () const |
unsigned | GetChildrenNumber () const |
virtual Object * | GetAtomAt (double x, double y, double z=0.) |
virtual bool | Build (std::set< Object * > const &Children) throw (std::invalid_argument) |
virtual bool | BuildContextualMenu (UIManager *uim, Object *object, double x, double y) |
void | EmitSignal (SignalId Signal) |
virtual bool | OnSignal (SignalId Signal, Object *Child) |
void | Lock (bool state=true) |
bool | IsLocked () |
Object * | GetFirstLink (std::set< Object * >::iterator &i) |
Object * | GetNextLink (std::set< Object * >::iterator &i) |
void | Link (Object *object) |
void | Unlink (Object *object) |
virtual void | OnUnlink (Object *object) |
void | GetPossibleAncestorTypes (std::set< TypeId > &types) const |
virtual void | OnLoaded () |
void | SetDirty (bool dirty=true) |
virtual void | Clear () |
std::string | Identity () |
virtual char const * | HasPropertiesDialog () const |
virtual bool | CanSelect () const |
virtual void | NotifyEmpty () |
void | ShowPropertiesDialog () |
bool | GetDirty (void) const |
Public Member Functions inherited from gcu::DialogOwner | |
DialogOwner () | |
virtual | ~DialogOwner () |
Dialog * | GetDialog (std::string name) const |
void | ClearDialogs () |
Public Member Functions inherited from gccv::ItemClient | |
ItemClient () | |
virtual | ~ItemClient () |
virtual void | UpdateItem () |
Item * | GetItem (void) |
Protected Member Functions | |
void | BuildSymbolGeometry (double width, double height, double ascent) |
bool | SetProperty (unsigned property, char const *value) |
Protected Attributes | |
double | m_CHeight |
Protected Attributes inherited from gcu::Atom | |
int | m_Z |
double | m_x |
double | m_y |
double | m_z |
char | m_Charge |
std::map< Atom *, Bond * > | m_Bonds |
Protected Attributes inherited from gccv::ItemClient | |
Item * | m_Item |
Additional Inherited Members | |
Static Public Member Functions inherited from gcu::Object | |
static TypeId | AddType (std::string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType) |
static void | AddAlias (TypeId id, std::string TypeName) |
static Object * | CreateObject (const std::string &TypeName, Object *parent=NULL) |
static TypeId | GetTypeId (const std::string &Name) |
static std::string | GetTypeName (TypeId Id) |
static void | AddMenuCallback (TypeId Id, BuildMenuCb cb) |
static void | AddRule (TypeId type1, RuleId rule, TypeId type2) |
static void | AddRule (const std::string &type1, RuleId rule, const std::string &type2) |
static const std::set< TypeId > & | GetRules (TypeId type, RuleId rule) |
static const std::set< TypeId > & | GetRules (const std::string &type, RuleId rule) |
static void | SetCreationLabel (TypeId Id, std::string Label) |
static const std::string & | GetCreationLabel (TypeId Id) |
static const std::string & | GetCreationLabel (const std::string &TypeName) |
static SignalId | CreateNewSignalId () |
Represents atoms in GChemPaint.
Definition at line 113 of file gcp/atom.h.
gcp::Atom::Atom | ( | ) |
Default construtor.
Reimplemented from gcu::Atom.
gcp::Atom::Atom | ( | int | Z, |
double | x, | ||
double | y, | ||
double | z | ||
) |
Z | the atomic number. |
x | the x coordinate. |
y | the y coordinate. |
z | the z coordinate. |
Reimplemented from gcu::Atom.
|
virtual |
The destructor.
Reimplemented from gcu::Atom.
|
virtual |
charge | the charge that might be set. |
Reimplemented in gcp::FragmentAtom.
|
virtual |
nb | the number of bonds to add, taking orders into account. |
Reimplemented in gcp::FragmentAtom.
|
virtual |
void gcp::Atom::AddElectron | ( | Electron * | electron | ) |
|
virtual |
Used to add a representation of the atom in the view.
Reimplemented from gccv::ItemClient.
Reimplemented in gcp::FragmentAtom.
|
virtual |
Mol,: | a pointer to a molecule |
Adds the atom to the molecule calling gcpMolecule::AddAtom()
Reimplemented in gcp::FragmentAtom.
bool gcp::Atom::BuildContextualMenu | ( | gcu::UIManager * | UIManager, |
Object * | object, | ||
double | x, | ||
double | y | ||
) |
UIManager,: | the gcu::UIManager to populate. |
object | the atom 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 a contextual menu for the atom.
|
protected |
width | the witdh of the atomic symbol. |
height | the height of the atomic symbol. |
ascent | the ascent of the atomic symbol. |
Evaluates where lines representing bonds should end to not overload the symbol.
|
inline |
Forces an update.
Definition at line 348 of file gcp/atom.h.
|
inline |
Definition at line 164 of file gcp/atom.h.
|
virtual |
x | the x position. |
y | the y position. |
This method finds an available position for drawing a charge sign or electrons and returns it as a symbolic value (see POSITION_E, POSITION_N,...). The x and y are updated so that they give the absolute position.
Reimplemented in gcp::FragmentAtom.
HPos gcp::Atom::GetBestSide | ( | ) |
Bond* gcp::Atom::GetBondAtAngle | ( | double | angle | ) |
angle | the angle from the east direction in the trigonometric convention. |
|
inline |
Definition at line 344 of file gcp/atom.h.
References gcu::Atom::m_Charge.
|
inline |
Definition at line 503 of file gcp/atom.h.
|
virtual |
Pos | the approximate position of the charge. |
Angle | the angle from horizontal left. |
x | the x position of the charge symbol. |
y | the y position of the charge symbol. |
On input Pos can be one of POSITION_E, POSITION_N,... or 0xff, in which case, it will be given a default value. x and y are set to the position where the charge sign should be displayed usding the alignment code returned by this method.
Reimplemented in gcp::FragmentAtom.
char gcp::Atom::GetChargePosition | ( | double * | Angle, |
double * | Dist | ||
) | const |
Angle | where to store the angle from east direction in the trigonometric convention. |
Dist | where to store the distance from the center of the atom. |
|
inline |
Definition at line 491 of file gcp/atom.h.
Bond* gcp::Atom::GetNewmanBond | ( | ) | const |
|
virtual |
angle | the angle at which a charge sign or an electron should be displayed. |
x | the x position. |
y | the y position. |
Updates x and y so that they become the absolute position corresponding to the angle when the position is available.
Reimplemented in gcp::FragmentAtom.
|
inline |
Definition at line 491 of file gcp/atom.h.
|
inline |
Definition at line 478 of file gcp/atom.h.
|
virtual |
angle | the angle at which a charge sign or an electron should be displayed. |
x | the x position. |
y | the y position. |
Updates x and y so that they become the position corresponding to the angle when the position is available, the origin being the position of the atom.
|
inline |
Definition at line 515 of file gcp/atom.h.
|
inline |
Definition at line 478 of file gcp/atom.h.
void gcp::Atom::GetSymbolGeometry | ( | double & | width, |
double & | height, | ||
double & | angle, | ||
bool | up | ||
) | const |
width | where to store the width. |
height | where to store the height. |
angle | where to store the limit angle. |
up | whether considering the top half or the bottom half |
Used to retrieve the size of the ink rectangle of the atom symbol (if displayed). angle is absolute value of the angle between an horizontal line and the line joining the center and the top left or the bottom left vertex. The returned width value is actually half the full width. Height is the height. This method is used to avoid bonds lines extending over their atoms symbols.
int gcp::Atom::GetTotalBondsNumber | ( | ) | const |
|
virtual |
Reimplemented from gcu::Object.
bool gcp::Atom::HasAvailableElectrons | ( | bool | paired | ) |
paired | whether to ask for a pair of electrons or a single electron. |
bool gcp::Atom::HasImplicitElectronPairs | ( | ) |
bool gcp::Atom::HasStereoBond | ( | ) | const |
|
virtual |
node | a pointer to the xmlNode containing the serialized atom. |
Used to load an atom in memory. The Atom must already exist.
Reimplemented from gcu::Atom.
Reimplemented in gcp::FragmentAtom, and gcp::FragmentResidue.
|
virtual |
|
virtual |
atom | the atom to which the this instance is to be compared. |
state | the AtomMatchState representing the current comparison state. |
Try to match atoms from two molecules which are compared. This function calls itself recursively until all atoms from the two molecules have been matched or until an difference is found. Overriden methods should call this base function and return its result.
Reimplemented from gcu::Atom.
Reimplemented in gcp::FragmentAtom.
bool gcp::Atom::MayHaveImplicitUnpairedElectrons | ( | ) |
|
virtual |
void gcp::Atom::NotifyPositionOccupation | ( | unsigned char | pos, |
bool | occupied | ||
) |
pos | one of POSITION_E, POSITION_N,... |
occupied | true if occupied, false otherwise. |
Notifies if a position is occupied or not.
|
virtual |
void gcp::Atom::RemoveElectron | ( | Electron * | electron | ) |
|
virtual |
xml | the xmlDoc used to save the document. |
Used to save the Atom to the xmlDoc.
Reimplemented from gcu::Atom.
Reimplemented in gcp::FragmentAtom, and gcp::FragmentResidue.
void gcp::Atom::SetCharge | ( | int | charge | ) |
charge | the charge to set. |
Sets the formal local charge of an atom.
|
inline |
item | a gccv::Item. |
Sets the gccv::Item used to represent the formal charge of the atom, might be NULL.
Definition at line 503 of file gcp/atom.h.
void gcp::Atom::SetChargePosition | ( | unsigned char | Pos, |
bool | def, | ||
double | angle = 0. , |
||
double | distance = 0. |
||
) |
Pos | one of POSITION_E, POSITION_N,... |
def | true if the position is automatic. |
angle | the angle from the east direction in the trigonometric convention. |
distance | the distance from the center of the atom, or 0. if automatic. |
Sets the relative position of a charge sign.
|
inline |
val | the new position. |
Sets the position of attached hydrogen atoms symbol.
Definition at line 491 of file gcp/atom.h.
|
protectedvirtual |
property | the identity of the property as defined in objprops.h. |
value | the value of the property as a string. |
Used by the gcu::Loader mechanism to load properties of atoms.
Reimplemented from gcu::Atom.
|
virtual |
state | the selection state of the atom. |
Used to set the selection state of the atom inside the widget. The values of state might be gcp::SelStateUnselected, gcp::SelStateSelected, gcp::SelStateUpdating, or gcp::SelStateErasing.
Reimplemented from gccv::ItemClient.
Reimplemented in gcp::FragmentAtom.
|
inline |
show | whether to display the local charge. |
Shows or hides the atom local charge.
Definition at line 515 of file gcp/atom.h.
|
inline |
ShowSymbol | whether the symbol of a carbon atom is to be displayed or not. |
Sets the visibility of a carbon atom symbol in a chain.
Definition at line 478 of file gcp/atom.h.
|
virtual |
Z | the new atomic number. |
Changes the atomic number of the atom.
Reimplemented from gcu::Atom.
Reimplemented in gcp::FragmentAtom.
|
virtual |
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 an object.
Reimplemented from gcu::Atom.
|
virtual |
Updates the atom after changing its bonds, charge or explicit electrons.
Reimplemented in gcp::FragmentAtom.
bool gcp::Atom::UpdateStereoBonds | ( | ) |
Infers which bonds should be displayed as stereobonds given the known parity and molecular structure.
|
protected |
Half the height of the "C" character.
Definition at line 465 of file gcp/atom.h.