The Gnome Chemistry Utils
0.12.11
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * crystalline.h 00006 * 00007 * Copyright (C) 2002-2008 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_LINE_H 00026 #define CRYSTAL_LINE_H 00027 00028 #include <libxml/parser.h> 00029 #include <list> 00030 00032 namespace gcu 00033 { 00034 00043 enum CrystalLineType 00044 { 00045 edges = 0, 00046 diagonals, 00047 medians, 00048 normal, 00049 unique 00050 }; 00051 00055 class CrystalLine 00056 { 00057 public: 00061 CrystalLine (); 00065 virtual ~CrystalLine (); 00066 00067 public : 00084 CrystalLine (CrystalLineType Type, double X1, double Y1, double Z1, double X2, double Y2, double Z2, double r, float red, float green, float blue, float alpha); 00090 CrystalLine (CrystalLine& clLine); 00097 CrystalLine& operator= (CrystalLine& clLine); 00098 00102 double X1 (void) {return m_dx;} 00106 double Y1 (void) {return m_dy;} 00110 double Z1 (void) {return m_dz;} 00114 double X2 (void) {return m_dx2;} 00118 double Y2 (void) {return m_dy2;} 00122 double Z2 (void) {return m_dz2;} 00126 double Xmax (); 00130 double Ymax (); 00134 double Zmax (); 00138 double Xmin (); 00142 double Ymin (); 00146 double Zmin (); 00150 double Long () {return m_dl;} 00154 CrystalLineType Type () {return m_nType;} 00165 void SetPosition (double x, double y, double z, double x1, double y1, double z1); 00174 void SetColor (float red, float green, float blue, float alpha); 00183 void GetColor (double *red, double *green, double *blue, double *alpha); 00189 void SetRadius (double r); 00193 double GetRadius () {return m_dr;}; 00198 bool operator== (CrystalLine& clLine); 00206 virtual void Move (double x, double y, double z); 00217 double ScalProd (int h, int k, int l); 00222 void Cleave () {m_nCleave++;} 00235 void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma); 00248 double Distance (double x, double y, double z, bool bFixed); 00252 bool IsCleaved () {return m_nCleave != 0;} 00262 void GetRotation (double& x, double& y, double& z, double& th); 00269 virtual xmlNodePtr Save (xmlDocPtr xml) const; 00275 virtual bool Load (xmlNodePtr node); 00276 00277 protected : 00281 float m_fBlue; 00285 float m_fRed; 00289 float m_fGreen; 00293 float m_fAlpha; 00297 double m_dx; 00301 double m_dy; 00305 double m_dz; 00309 double m_dx2; 00313 double m_dy2; 00317 double m_dz2; 00321 double m_dr; 00327 int m_nCleave; //0 if not cleaved 00336 CrystalLineType m_nType; 00337 00338 private: 00339 double m_dl; 00340 double m_dxrot; 00341 double m_dyrot; 00342 double m_darot;//rotation axis coordinates (z = 0) and angle 00343 }; 00344 00348 typedef std::list<CrystalLine*> CrystalLineList; 00349 00353 extern char const *LineTypeName[]; 00354 00355 }// namespace gcu 00356 00357 #endif // CRYSTAL_BOND_H