The Gnome Chemistry Utils  0.12.11
Public Member Functions | Protected Member Functions | Protected Attributes
gcu::CrystalAtom Class Reference

#include <gcu/crystalatom.h>

Inheritance diagram for gcu::CrystalAtom:
gcu::Atom gcu::Object

List of all members.

Public Member Functions

 CrystalAtom (CrystalAtom &caAtom)
void SetColor (float red, float green, float blue, float alpha)
void SetDefaultColor ()
bool HasCustomColor ()
void GetColor (double *red, double *green, double *blue, double *alpha)
void SetSize (double r)
double GetSize ()
bool operator== (CrystalAtom &caAtom)
void Cleave ()
double ScalProd (int h, int k, int l)
void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma)
double Distance (double x, double y, double z, bool bFixed)
double r ()
const GcuAtomicRadiusGetRadius ()
void SetRadius (const GcuAtomicRadius &r)
bool IsCleaved ()
virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const
virtual bool LoadNode (xmlNodePtr node)
- Public Member Functions inherited from gcu::Atom
 Atom ()
 Atom (int Z, double x, double y, double z=0.)
 Atom (Atom &a)
Atomoperator= (Atom &a)
virtual ~Atom ()
double Distance (Atom *pAtom)
void zoom (double ZoomFactor)
virtual bool GetCoords (double *x, double *y, double *z=NULL) const
void SetCoords (double x, double y, double z=0)
int GetZ () const
virtual void SetZ (int Z)
virtual void SetCharge (char Charge)
char GetCharge ()
virtual const gchar * GetSymbol () const
virtual void AddBond (Bond *pBond)
virtual void RemoveBond (Bond *pBond)
double x () const
double y () const
double z () const
Vector GetVector () const
BondGetFirstBond (std::map< Atom *, Bond * >::iterator &i)
BondGetNextBond (std::map< Atom *, Bond * >::iterator &i)
BondGetBond (Atom *pAtom) const
int GetBondsNumber () const
virtual xmlNodePtr Save (xmlDocPtr xml) const
virtual bool Load (xmlNodePtr node)
virtual void Move (double x, double y, double z=0.)
virtual void Transform2D (Matrix2D &m, double x, double y)
bool IsInCycle (Cycle *pCycle)
virtual bool Match (Atom *atom, AtomMatchState &state)
std::string Name ()
- Public Member Functions inherited from gcu::Object
 Object (TypeId Id=OtherType)
virtual ~Object ()
TypeId GetType () const
void SetId (gchar const *Id)
gchar const * GetId () const
virtual void AddChild (Object *object)
ObjectGetMolecule () const
ObjectGetReaction () const
ObjectGetGroup () const
DocumentGetDocument () 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 gchar *Id) const
ObjectGetParent () 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 ObjectGetAtomAt (double x, double y, double z=0.)
virtual bool Build (std::list< Object * > &Children) throw (std::invalid_argument)
virtual double GetYAlign ()
virtual bool BuildContextualMenu (GtkUIManager *UIManager, 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
virtual void OnLoaded ()
void SetDirty (bool dirty=true)
virtual void Clear ()
std::string Identity ()
virtual char const * HasPropertiesDialog () const
void ShowPropertiesDialog ()
bool GetDirty (void) const

Protected Member Functions

bool SetProperty (unsigned property, char const *value)
std::string GetProperty (unsigned property) const

Protected Attributes

float m_fBlue
float m_fRed
float m_fGreen
float m_fAlpha
bool m_bCustomColor
GcuAtomicRadius m_Radius
int m_nCleave
- 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

Detailed Description

Used to represent atoms in a crystal.

Definition at line 45 of file crystalatom.h.


Constructor & Destructor Documentation

gcu::CrystalAtom::CrystalAtom ( CrystalAtom caAtom)
Parameters:
caAtom,:the CrystalAtom to duplicate.

Creates a new CrystalAtom identical to caAtom.


Member Function Documentation

void gcu::CrystalAtom::Cleave ( )
inline

Method used to cleave an atom. The inverse operation does not exist since the whole crystal must be recalculated after a change in the definition.

Definition at line 126 of file crystalatom.h.

References m_nCleave.

double gcu::CrystalAtom::Distance ( double  x,
double  y,
double  z,
bool  bFixed 
)
Parameters:
x,:the x coordinate of the center.
y,:the y coordinate of the center.
z,:the z coordinate of the center.
bFixed,:tells if cleaved atoms are taken into account.

This helper method is called when searching for the size of the crystal. When some cleavages are defined, the procedure cn take into account atoms cleaved to get the same position in the view for the cleaved crystal than for the whole crystal. If bFixed is true, all atoms are taken into account.

Returns:
the distance of the atom to the center of the view or 0 if bFixed is false and the atom cleaved.
void gcu::CrystalAtom::GetColor ( double *  red,
double *  green,
double *  blue,
double *  alpha 
)
Parameters:
red,:a pointer to the red component.
green,:a pointer to the green component.
blue,:a pointer to the blue component.
alpha,:a pointer to the alpha component.

Used to retrieve the color used in the representation of the atom. Mainly useful for user defined colors.

std::string gcu::CrystalAtom::GetProperty ( unsigned  property) const
protectedvirtual
Parameters:
propertythe identity of the property as defined in objprops.h.

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

Returns:
the value of the property as a string.

Reimplemented from gcu::Atom.

const GcuAtomicRadius& gcu::CrystalAtom::GetRadius ( )
inline
Returns:
the GcuAtomicRadius containing the caracteristics of the atom radius.

Definition at line 169 of file crystalatom.h.

References m_Radius.

double gcu::CrystalAtom::GetSize ( )
Returns:
the value of the radius (in pm).
bool gcu::CrystalAtom::HasCustomColor ( )
inline
Returns:
: true if the color is user defined and false if it is the default color.

Definition at line 96 of file crystalatom.h.

References m_bCustomColor.

bool gcu::CrystalAtom::IsCleaved ( )
inline
Returns:
true if the atom is cleaved by at least one cleavage or false if the atom is not cleaved at all.

Definition at line 177 of file crystalatom.h.

References m_nCleave.

virtual bool gcu::CrystalAtom::LoadNode ( xmlNodePtr  node)
virtual
Parameters:
node,:a pointer to the xmlNode containing the serialized Atom.

Loads the color and the radius of the atom.

Reimplemented from gcu::Atom.

void gcu::CrystalAtom::NetToCartesian ( double  a,
double  b,
double  c,
double  alpha,
double  beta,
double  gamma 
)
Parameters:
a,:the a parameter of the unit cell.
b,:the b parameter of the unit cell.
c,:the c parameter of the unit cell.
alpha,:the alpha angle of the unit cell.
beta,:the beta angle of the unit cell.
gamma,:the gamma angle of the unit cell.

Converts the coordinates of the atom from net related ones to cartesian. Initially, atoms are defined by their position relative to the unit cell and the coordinates must be transformed to the cartesian ones before displaying the atom.

bool gcu::CrystalAtom::operator== ( CrystalAtom caAtom)
Parameters:
caAtom,:a CrystalAtom instance.
Returns:
true if the atoms are at the same position and false if their positions are different.
double gcu::CrystalAtom::r ( )
inline
Returns:
the value of the radius (in pm).

Definition at line 165 of file crystalatom.h.

References m_Radius, GcuDimensionalValue::value, and GcuAtomicRadius::value.

virtual bool gcu::CrystalAtom::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 Atom is serialized.

Saves the color and the radius of the atom.

Reimplemented from gcu::Atom.

double gcu::CrystalAtom::ScalProd ( int  h,
int  k,
int  l 
)
Parameters:
h,:the h Miller index of a plane.
k,:the k Miller index of a plane.
l,:the l Miller index of a plane.
Returns:
the product hx+ky+lz where x, y and z are the coordinates of the atom. This makes sense only if coordinates are related to the net and are not the cartesian coordinates. This method should not be called after NetToCartesian().
void gcu::CrystalAtom::SetColor ( float  red,
float  green,
float  blue,
float  alpha 
)
Parameters:
red,:the red component of the color.
green,:the green component of the color.
blue,:the blue component of the color.
alpha,:the alpha component of the color.

Sets a custom color to the atom.

void gcu::CrystalAtom::SetDefaultColor ( )

Gives the atom the default color.

bool gcu::CrystalAtom::SetProperty ( unsigned  property,
char const *  value 
)
protectedvirtual
Parameters:
propertythe identity of the property as defined in objprops.h.
valuethe value of the property as a string.

Used by the gcu::Loader mechanism to load properties of atoms.

Returns:
true on success.

Reimplemented from gcu::Atom.

void gcu::CrystalAtom::SetRadius ( const GcuAtomicRadius r)
Parameters:
r,:a GcuAtomicRadius with the caracteristics of the atom radius.
void gcu::CrystalAtom::SetSize ( double  r)
Parameters:
r,:the new value of the atomic radius.

Sets the value of the radius (in pm).


Member Data Documentation

bool gcu::CrystalAtom::m_bCustomColor
protected

False if the color used is the default color and true if it is a user defined color.

Definition at line 212 of file crystalatom.h.

Referenced by HasCustomColor().

float gcu::CrystalAtom::m_fAlpha
protected

The alpha component of the color of the sphere representing the atom.

Definition at line 208 of file crystalatom.h.

float gcu::CrystalAtom::m_fBlue
protected

The blue component of the color of the sphere representing the atom.

Definition at line 196 of file crystalatom.h.

float gcu::CrystalAtom::m_fGreen
protected

The green component of the color of the sphere representing the atom.

Definition at line 204 of file crystalatom.h.

float gcu::CrystalAtom::m_fRed
protected

The red component of the color of the sphere representing the atom.

Definition at line 200 of file crystalatom.h.

int gcu::CrystalAtom::m_nCleave
protected

When cleavages (see CrystalCleavage class documentation) are defined, the atom might be cleaved. m_nCleave is the number of CrystalCleavage instances which remove the atom. If this member is not 0, the atom will not be displayed.

Definition at line 222 of file crystalatom.h.

Referenced by Cleave(), and IsCleaved().

GcuAtomicRadius gcu::CrystalAtom::m_Radius
protected

The GcuAtomicRadius containing the radius caracteristics of the atom.

Definition at line 216 of file crystalatom.h.

Referenced by GetRadius(), and r().


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