The Gnome Chemistry Utils 0.13.5
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * gcr/line.h 00006 * 00007 * Copyright (C) 2002-2011 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 GCR_LINE_H 00026 #define GCR_LINE_H 00027 00028 #include <gtk/gtk.h> 00029 #include <libxml/parser.h> 00030 #include <list> 00031 00033 namespace gcr { 00034 00043 enum LineType 00044 { 00045 edges = 0, 00046 diagonals, 00047 medians, 00048 normal, 00049 unique 00050 }; 00051 00055 class Line 00056 { 00057 public: 00061 Line (); 00065 virtual ~Line (); 00066 00067 public : 00084 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); 00090 Line (Line& clLine); 00097 Line& operator= (Line& 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 LineType &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); 00175 void SetColor (GdkRGBA rgba); 00184 void GetColor (double *red, double *green, double *blue, double *alpha); 00185 void GetColor (GdkRGBA &rgba); 00191 void SetRadius (double r); 00195 double GetRadius () {return m_dr;}; 00200 bool operator== (Line& clLine); 00208 virtual void Move (double x, double y, double z); 00219 double ScalProd (int h, int k, int l); 00224 void Cleave () {m_nCleave++;} 00237 void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma); 00250 double Distance (double x, double y, double z, bool bFixed); 00254 bool IsCleaved () {return m_nCleave != 0;} 00264 void GetRotation (double& x, double& y, double& z, double& th); 00271 virtual xmlNodePtr Save (xmlDocPtr xml) const; 00277 virtual bool Load (xmlNodePtr node); 00278 00279 protected : 00283 float m_fBlue; 00287 float m_fRed; 00291 float m_fGreen; 00295 float m_fAlpha; 00299 double m_dx; 00303 double m_dy; 00307 double m_dz; 00311 double m_dx2; 00315 double m_dy2; 00319 double m_dz2; 00323 double m_dr; 00329 int m_nCleave; //0 if not cleaved 00338 LineType m_nType; 00339 00340 private: 00341 double m_dl; 00342 double m_dxrot; 00343 double m_dyrot; 00344 double m_darot;//rotation axis coordinates (z = 0) and angle 00345 }; 00346 00350 typedef std::list<Line*> LineList; 00351 00355 extern char const *LineTypeName[]; 00356 00357 } // namespace gcr 00358 00359 #endif // GCR_BOND_H