The Gnome Chemistry Utils  0.14.0
gcr/line.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * gcr/line.h
6  *
7  * Copyright (C) 2002-2012 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 3 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 GCR_LINE_H
26 #define GCR_LINE_H
27 
28 #include <gtk/gtk.h>
29 #include <libxml/parser.h>
30 #include <list>
31 
33 namespace gcr {
34 
44 {
45  edges = 0,
46  diagonals,
47  medians,
48  normal,
49  unique
50 };
51 
55 class Line
56 {
57 public:
61  Line ();
65  virtual ~Line ();
66 
67 public :
84  Line (LineType Type, double X1, double Y1, double Z1, double X2, double Y2, double Z2, double r, float red, float green, float blue, float alpha);
90  Line (Line& clLine);
97  Line& operator= (Line& 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;}
154  LineType &Type () {return m_nType;}
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);
180  void SetColor (GdkRGBA rgba);
189  void GetColor (double *red, double *green, double *blue, double *alpha);
195  void GetColor (GdkRGBA &rgba);
201  void SetRadius (double r);
205  double GetRadius () {return m_dr;};
210  bool operator== (Line& clLine);
218  virtual void Move (double x, double y, double z);
229  double ScalProd (int h, int k, int l);
234  void Cleave () {m_nCleave++;}
247  void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
260  double Distance (double x, double y, double z, bool bFixed);
264  bool IsCleaved () {return m_nCleave != 0;}
274  void GetRotation (double& x, double& y, double& z, double& th);
281  virtual xmlNodePtr Save (xmlDocPtr xml) const;
287  virtual bool Load (xmlNodePtr node);
288 
289 protected :
293  float m_fBlue;
297  float m_fRed;
301  float m_fGreen;
305  float m_fAlpha;
309  double m_dx;
313  double m_dy;
317  double m_dz;
321  double m_dx2;
325  double m_dy2;
329  double m_dz2;
333  double m_dr;
339  int m_nCleave; //0 if not cleaved
349 
350 private:
351  double m_dl;
352  double m_dxrot;
353  double m_dyrot;
354  double m_darot;//rotation axis coordinates (z = 0) and angle
355 };
356 
360 typedef std::list<Line*> LineList;
361 
365 extern char const *LineTypeName[];
366 
367 } // namespace gcr
368 
369 #endif // GCR_BOND_H