gcp::Bond Class Reference
#include <gcp/bond.h>
List of all members.
Public Member Functions |
| Bond () |
| Bond (Atom *first, Atom *last, unsigned char order) |
virtual | ~Bond () |
Object * | GetAtomAt (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 | Update (GtkWidget *w) const |
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 | SetSelected (GtkWidget *w, int state) |
void | Add (GtkWidget *w) const |
double | GetYAlign () |
bool | IsCrossing (Bond *pBond) |
bool | BuildContextualMenu (GtkUIManager *UIManager, Object *object, double x, double y) |
void | MoveToBack () |
void | BringToFront () |
bool | SetProperty (unsigned property, char const *value) |
Detailed Description
This class is used to represent bonds.
Definition at line 73 of file gcp/bond.h.
Constructor & Destructor Documentation
The default constructor.
Reimplemented from gcu::Bond.
gcp::Bond::Bond |
( |
Atom * |
first, |
|
|
Atom * |
last, |
|
|
unsigned char |
order | |
|
) |
| | |
- Parameters:
-
| first | the first bonded atom. |
| last | the last bonded atom. |
| order | the 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::Add |
( |
GtkWidget * |
w |
) |
const [virtual] |
- Parameters:
-
| w | the GtkWidget inside which the bond will be displayed. |
Used to add a representation of the bond in the widget.
Reimplemented from gcu::Object.
void gcp::Bond::AddCycle |
( |
gcu::Cycle * |
pCycle |
) |
[virtual] |
- Parameters:
-
| pCycle | a cycle containing the bond. |
Notifies the bond it is in the cycle.
Reimplemented from gcu::Bond.
void gcp::Bond::BringToFront |
( |
|
) |
|
Brings the bond to front. It has an effect only for crossing bonds.
bool gcp::Bond::BuildContextualMenu |
( |
GtkUIManager * |
UIManager, |
|
|
Object * |
object, |
|
|
double |
x, |
|
|
double |
y | |
|
) |
| | |
- Parameters:
-
| UIManager,: | the GtkUIManager 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.
double gcp::Bond::GetAngle2D |
( |
Atom * |
pAtom |
) |
|
- Parameters:
-
| pAtom | one 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:
-
| x | the x coordinate |
| y | the y coordinate |
| z | the 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:
-
| x | the x coordinate. |
| y | the 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:
-
| Num | the index of the line representing a, possibly, multiple bond. |
| x1 | where to store the first x coordinate. |
| y1 | where to store the first y coordinate. |
| x2 | where to store the second x coordinate. |
| y2 | where 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.
BondType gcp::Bond::GetType |
( |
|
) |
const [inline] |
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:
-
| n | the 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:
-
| pBond | a 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:
-
| node | a 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:
-
| x | the x component of the transation vector. |
| y | the y component of the transation vector. |
| z | the 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::RemoveAllCycles |
( |
|
) |
[virtual] |
Clears the list of the cycles containing the bond.
Reimplemented from gcu::Bond.
void gcp::Bond::RemoveCycle |
( |
gcu::Cycle * |
pCycle |
) |
[virtual] |
- Parameters:
-
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:
-
| xml | the xmlDoc used to save the document. |
| node | a 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:
-
| property | the property id as defined in objprops.h |
| value | the 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 |
( |
GtkWidget * |
w, |
|
|
int |
state | |
|
) |
| | [virtual] |
void gcp::Bond::SetType |
( |
BondType |
type |
) |
|
- Parameters:
-
Sets the bond type.
void gcp::Bond::Transform2D |
( |
gcu::Matrix2D & |
m, |
|
|
double |
x, |
|
|
double |
y | |
|
) |
| | [virtual] |
- 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 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::Update |
( |
GtkWidget * |
w |
) |
const [virtual] |
- Parameters:
-
| w | the GtkWidget inside which the bond is displayed. |
Used to update the representation of the bond in the widget.
Reimplemented from gcu::Object.
The documentation for this class was generated from the following file: