crystalbond.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * crystalbond.h 
00006  *
00007  * Copyright (C) 2002-2004 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef CRYSTAL_BOND_H
00026 #define CRYSTAL_BOND_H
00027 
00028 #include <libxml/parser.h>
00029 #include <list>
00030 #include "bond.h"
00031 
00032 using namespace std;
00033 
00034 namespace gcu
00035 {
00036 
00040 class CrystalBond: public Bond 
00041 {
00042 public:
00043         CrystalBond ();
00044         virtual ~CrystalBond ();
00045 
00046 public :
00047         CrystalBond (double X1, double Y1, double Z1, double X2, double Y2, double Z2, double r, float red, float green, float blue, float alpha);
00048         CrystalBond (CrystalBond& cbBond);
00049         CrystalBond& operator= (CrystalBond&);
00050 
00051         void Draw ();
00052         double X1 (void) {return m_dx;}
00053         double Y1 (void) {return m_dy;}
00054         double Z1 (void) {return m_dz;}
00055         double X2 (void) {return m_dx2;}
00056         double Y2 (void) {return m_dy2;}
00057         double Z2 (void) {return m_dz2;}
00058         double Xmax ();
00059         double Ymax ();
00060         double Zmax ();
00061         double Xmin ();
00062         double Ymin ();
00063         double Zmin ();
00064         double Long () {return m_dl;}
00065         void SetPosition (double x, double y, double z, double x1, double y1, double z1);
00066         void SetColor (float red, float green, float blue, float alpha);
00067         void GetColor (double *red, double *green, double *blue, double *alpha);
00068         void SetRadius (double r);
00069         double GetRadius () {return m_dr;};
00070         bool operator== (CrystalBond&);
00071         virtual void Move (double x, double y, double z);
00072         double ScalProd (int h, int k, int l);
00073         void Cleave () {m_nCleave++;}
00074         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
00075         double Distance (double x, double y, double z, bool bFixed);
00076         bool IsCleaved () {return m_nCleave != 0;}
00077         void GetRotation (double& x, double& y, double& z, double& th);
00078         virtual xmlNodePtr Save (xmlDocPtr xml);
00079         virtual bool Load (xmlNodePtr node);
00080         
00081 private :
00082         float m_fBlue, m_fRed, m_fGreen, m_fAlpha;
00083         double m_dx, m_dy, m_dz, m_dx2, m_dy2, m_dz2, m_dr, m_dl;
00084         double m_dxrot, m_dyrot, m_darot;//rotation axis coordinates (z = 0) and angle
00085         int m_nCleave; //0 if not cleaved
00086 };
00087 
00088 typedef list<CrystalBond*> CrystalBondList;
00089 
00090 }// namespace gcu
00091 
00092 #endif // CRYSTAL_BOND_H

Generated on Tue Aug 15 10:47:35 2006 for The Gnome Chemistry Utils by  doxygen 1.4.7