The Gnome Chemistry Utils  0.12.11
crystalline.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * crystalline.h
6  *
7  * Copyright (C) 2002-2008 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef CRYSTAL_LINE_H
26 #define CRYSTAL_LINE_H
27 
28 #include <libxml/parser.h>
29 #include <list>
30 
32 namespace gcu
33 {
34 
44 {
45  edges = 0,
46  diagonals,
47  medians,
48  normal,
49  unique
50 };
51 
56 {
57 public:
61  CrystalLine ();
65  virtual ~CrystalLine ();
66 
67 public :
84  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);
90  CrystalLine (CrystalLine& clLine);
98 
102  double X1 (void) {return m_dx;}
106  double Y1 (void) {return m_dy;}
110  double Z1 (void) {return m_dz;}
114  double X2 (void) {return m_dx2;}
118  double Y2 (void) {return m_dy2;}
122  double Z2 (void) {return m_dz2;}
126  double Xmax ();
130  double Ymax ();
134  double Zmax ();
138  double Xmin ();
142  double Ymin ();
146  double Zmin ();
150  double Long () {return m_dl;}
165  void SetPosition (double x, double y, double z, double x1, double y1, double z1);
174  void SetColor (float red, float green, float blue, float alpha);
183  void GetColor (double *red, double *green, double *blue, double *alpha);
189  void SetRadius (double r);
193  double GetRadius () {return m_dr;};
198  bool operator== (CrystalLine& clLine);
206  virtual void Move (double x, double y, double z);
217  double ScalProd (int h, int k, int l);
222  void Cleave () {m_nCleave++;}
235  void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
248  double Distance (double x, double y, double z, bool bFixed);
252  bool IsCleaved () {return m_nCleave != 0;}
262  void GetRotation (double& x, double& y, double& z, double& th);
269  virtual xmlNodePtr Save (xmlDocPtr xml) const;
275  virtual bool Load (xmlNodePtr node);
276 
277 protected :
281  float m_fBlue;
285  float m_fRed;
289  float m_fGreen;
293  float m_fAlpha;
297  double m_dx;
301  double m_dy;
305  double m_dz;
309  double m_dx2;
313  double m_dy2;
317  double m_dz2;
321  double m_dr;
327  int m_nCleave; //0 if not cleaved
337 
338 private:
339  double m_dl;
340  double m_dxrot;
341  double m_dyrot;
342  double m_darot;//rotation axis coordinates (z = 0) and angle
343 };
344 
348 typedef std::list<CrystalLine*> CrystalLineList;
349 
353 extern char const *LineTypeName[];
354 
355 }// namespace gcu
356 
357 #endif // CRYSTAL_BOND_H