The Gnome Chemistry Utils  0.14.0
Public Member Functions | List of all members
gcp::Bond Class Reference

#include <gcp/bond.h>

Inheritance diagram for gcp::Bond:
gcu::Bond gccv::ItemClient gcu::Object

Public Member Functions

 Bond ()
 Bond (Atom *first, Atom *last, unsigned char order)
virtual ~Bond ()
ObjectGetAtomAt (double x, double y, double z=0.)
BondType GetType () const
void SetType (BondType type)
double GetAngle2D (Atom *pAtom)
void AddCycle (gcu::Cycle *pCycle)
void RemoveCycle (gcu::Cycle *pCycle)
void RemoveAllCycles ()
bool GetLine2DCoords (unsigned Num, double *x1, double *y1, double *x2, double *y2)
virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const
bool LoadNode (xmlNodePtr node)
void Move (double x, double y, double z=0)
void Transform2D (gcu::Matrix2D &m, double x, double y)
double GetDist (double x, double y)
void SetDirty ()
void Revert ()
void IncOrder (int n=1)
void AddItem ()
void UpdateItem ()
void SetSelected (int state)
double GetYAlign ()
bool IsCrossing (Bond *pBond)
bool BuildContextualMenu (gcu::UIManager *UIManager, Object *object, double x, double y)
void MoveToBack ()
void BringToFront ()
std::string GetProperty (unsigned property) const
bool SetProperty (unsigned property, char const *value)
void AdjustPosition (double &x, double &y)
void OnLoaded ()
- Public Member Functions inherited from gcu::Bond
 Bond (Atom *first, Atom *last, unsigned char order)
virtual AtomGetAtom (int which) const
virtual AtomGetAtom (Atom *pAtom, int which=0) const
virtual Atom const * GetAtom (Atom const *pAtom, int which=0) const
unsigned char GetOrder () const
void SetOrder (unsigned char Order)
virtual xmlNodePtr Save (xmlDocPtr xml) const
virtual bool Load (xmlNodePtr node)
unsigned IsCyclic ()
CycleGetFirstCycle (std::list< Cycle * >::iterator &i, Cycle *pCycle)
CycleGetNextCycle (std::list< Cycle * >::iterator &i, Cycle *pCycle)
bool IsInCycle (Cycle *pCycle)
double Get2DLength ()
double GetAngle2DRad (Atom *pAtom)
bool ReplaceAtom (Atom *oldAtom, Atom *newAtom)
std::string Name ()
- Public Member Functions inherited from gcu::Object
 Object (TypeId Id=OtherType)
virtual ~Object ()
void SetId (gchar const *Id)
char const * GetId () const
virtual void AddChild (Object *object)
ObjectGetMolecule () const
ObjectGetReaction () const
ObjectGetGroup () const
DocumentGetDocument () const
ApplicationGetApplication () const
ObjectGetParentOfType (TypeId Id) const
ObjectGetChild (const gchar *Id) const
ObjectGetFirstChild (std::map< std::string, Object * >::iterator &i)
ObjectGetNextChild (std::map< std::string, Object * >::iterator &i)
ObjectGetDescendant (const char *Id) const
ObjectGetParent () const
void SetParent (Object *Parent)
virtual bool GetCoords (double *x, double *y, double *z=NULL) const
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 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 ()
ObjectGetFirstLink (std::set< Object * >::iterator &i)
ObjectGetNextLink (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
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 gccv::ItemClient
 ItemClient ()
virtual ~ItemClient ()
ItemGetItem (void)

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 ObjectCreateObject (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 ()
- Protected Member Functions inherited from gcu::Object
virtual DialogBuildPropertiesDialog ()
- Protected Attributes inherited from gcu::Bond
unsigned char m_order
Atomm_Begin
Atomm_End
std::list< Cycle * > m_Cycles
- Protected Attributes inherited from gccv::ItemClient
Itemm_Item

Detailed Description

This class is used to represent bonds.

Definition at line 81 of file gcp/bond.h.

Constructor & Destructor Documentation

gcp::Bond::Bond ( )

The default constructor.

Reimplemented from gcu::Bond.

gcp::Bond::Bond ( Atom first,
Atom last,
unsigned char  order 
)
Parameters
firstthe first bonded atom.
lastthe last bonded atom.
orderthe bond order

Constructs a bond given its two terminal atoms and its order.

virtual gcp::Bond::~Bond ( )
virtual

The destructor.

Reimplemented from gcu::Bond.

Member Function Documentation

void gcp::Bond::AddCycle ( gcu::Cycle pCycle)
virtual
Parameters
pCyclea cycle containing the bond.

Notifies the bond it is in the cycle.

Reimplemented from gcu::Bond.

void gcp::Bond::AddItem ( )
virtual

Used to add a representation of the bond in the view.

Reimplemented from gccv::ItemClient.

void gcp::Bond::AdjustPosition ( double &  x,
double &  y 
)
Parameters
xthe x coordinate to adjust
ythe y coordinate to adjust

On entering coordinates are considered relative to the bond axis. This method adjust them so that they are put farer from the bond taking line width or multiple bonds line into account.

void gcp::Bond::BringToFront ( )

Brings the bond to front. It has an effect only for crossing bonds.

bool gcp::Bond::BuildContextualMenu ( gcu::UIManager UIManager,
Object object,
double  x,
double  y 
)
Parameters
UIManager,:the gcu::UIManager to populate.
objectthe atom on which occured the mouse click.
xx coordinate of the mouse click.
yy coordinate of the mouse click.

This method is called to build a contextual menu for the bond.

double gcp::Bond::GetAngle2D ( Atom pAtom)
Parameters
pAtomone of the bonded atoms
Returns
the angle (0 to 306°) that the bond makes from the horizontal when starting from pAtom.
Object* gcp::Bond::GetAtomAt ( double  x,
double  y,
double  z = 0. 
)
virtual
Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate
Returns
a pointer to a bonded atom at or near position defined by the coordinates passed as parameters.

Reimplemented from gcu::Object.

double gcp::Bond::GetDist ( double  x,
double  y 
)
Parameters
xthe x coordinate.
ythe x coordinate.

Evaluates the distance from the point with coordinates x and y to the bond. The line segment joining the two atoms is used whatever the type and the order of the bond.

Returns
the calculated distance in pm.
bool gcp::Bond::GetLine2DCoords ( unsigned  Num,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)
Parameters
Numthe index of the line representing a, possibly, multiple bond.
x1where to store the first x coordinate.
y1where to store the first y coordinate.
x2where to store the second x coordinate.
y2where to store the second y coordinate.

Retrievers the coordinates of one of the lines representing the bond. Num must be lower than the bond order to succeed.

Returns
true on success, false otherwise.
std::string gcp::Bond::GetProperty ( unsigned  property) const
virtual
Parameters
propertythe identity of the property as defined in objprops.h.

Used by the gcu::Loader mechanism to retrieve properties of bonds.

Returns
the value of the property as a string.

Reimplemented from gcu::Bond.

BondType gcp::Bond::GetType ( void  ) const
inline
Returns
the type of the bond.

Reimplemented from gcu::Object.

Definition at line 113 of file gcp/bond.h.

double gcp::Bond::GetYAlign ( )
virtual

Used to retrieve the y coordinate for alignment.

Returns
y coordinate of the bond center.

Reimplemented from gcu::Object.

void gcp::Bond::IncOrder ( int  n = 1)
virtual
Parameters
nthe bond order increment. If not given, the default is 1.

Tries to increment the bond order by n units. If something goes wrong, the bond order is set to 1.

Reimplemented from gcu::Bond.

bool gcp::Bond::IsCrossing ( Bond pBond)
Parameters
pBonda bond which might cross.

The lines representing two bonds might cross. This method detects this condition.

Returns
true if bonds cross, false otherwise.
bool gcp::Bond::LoadNode ( xmlNodePtr  node)
virtual
Parameters
nodea pointer to the xmlNode containing the serialized Bond.

Loads properties specific to GChemPaint bonds.

Reimplemented from gcu::Bond.

void gcp::Bond::Move ( double  x,
double  y,
double  z = 0 
)
virtual
Parameters
xthe x component of the transation vector.
ythe y component of the transation vector.
zthe z component of the transation vector.

Used to move a bond. Just tells the bond it has been moved and that it's coordinates need to be reevaluated from the new atomic positions.

Reimplemented from gcu::Bond.

void gcp::Bond::MoveToBack ( )

Move the bond to the lowest position. It has an effect only for crossing bonds.

void gcp::Bond::OnLoaded ( )
virtual

This method should be called when a bond has been fully loaded.

Reimplemented from gcu::Bond.

void gcp::Bond::RemoveAllCycles ( )
virtual

Clears the list of the cycles containing the bond.

Reimplemented from gcu::Bond.

void gcp::Bond::RemoveCycle ( gcu::Cycle pCycle)
virtual
Parameters
pCyclea cycle.

Notifies the bond that it is not anymore in the cycle.

Reimplemented from gcu::Bond.

void gcp::Bond::Revert ( )

Exchanges the start and end atoms.

virtual bool gcp::Bond::SaveNode ( xmlDocPtr  xml,
xmlNodePtr  node 
) const
virtual
Parameters
xmlthe xmlDoc used to save the document.
nodea pointer to the xmlNode to which this Bond is serialized.

Saves the GChemPaint Bond class specific properties, such as the bond type (see gcp::BondType for more information).

Reimplemented from gcu::Bond.

void gcp::Bond::SetDirty ( )

Tells that the bond has changed, and that the items representing it should be updated accordingly.

bool gcp::Bond::SetProperty ( unsigned  property,
char const *  value 
)
virtual
Parameters
propertythe property id as defined in objprops.h
valuethe property value as a string

Used when loading to set properties for the bond. This method supports GCU_PROP_BOND_TYPE and calls gcu::Bond::SetProperty() for other properties.

Returns
true if the property could be set, or if the property is not relevant, false otherwise.

Reimplemented from gcu::Bond.

void gcp::Bond::SetSelected ( int  state)
virtual
Parameters
statethe selection state of the bond.

Used to set the selection state of the bond inside the widget. The values of state might be gcp::SelStateUnselected, gcp::SelStateSelected, gcp::SelStateUpdating, or gcp::SelStateErasing.

Reimplemented from gccv::ItemClient.

void gcp::Bond::SetType ( BondType  type)
Parameters
typethe new bond type.

Sets the bond type.

void gcp::Bond::Transform2D ( gcu::Matrix2D m,
double  x,
double  y 
)
virtual
Parameters
mthe Matrix2D of the transformation.
xthe x component of the center of the transformation.
ythe y component of the center of the transformation.

Used to move and/or transform a bond. Just tells the bond it has been moved and /or rotated and that it's coordinates need to be reevaluated from the new atomic positions.

Reimplemented from gcu::Bond.

void gcp::Bond::UpdateItem ( )
virtual

Used to update the representation of the bond in the view.

Reimplemented from gccv::ItemClient.


The documentation for this class was generated from the following file: