From 0633ed1b4ab66365b5f73e800c14be63744aa15b Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Sat, 24 Jun 2006 14:16:55 +0000 Subject: [PATCH] Benoit, please copy test.cml to /home/kde4/ and then test the latticeviewer. Somehow I will need a new view-type for crystals. I want it to look a bit like this http://upload.wikimedia.org/wikipedia/commons/d/db/NaCl-estructura_cristalina.svg Somehow setting the style like I did in latticedialog.cpp (commented out) doesn't work (gives me a blank widget...). Perhaps you have an idea. CCMAIL:kalzium@kde.org svn path=/trunk/KDE/kdeedu/kalzium/src/kalziumglwidget.h; revision=554591 --- kalzium/kalziumglwidget.cpp | 12 +++++++++++ kalzium/kalziumglwidget.h | 40 +++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/kalzium/kalziumglwidget.cpp b/kalzium/kalziumglwidget.cpp index f5c63cd..74c3a18 100644 --- a/kalzium/kalziumglwidget.cpp +++ b/kalzium/kalziumglwidget.cpp @@ -652,6 +652,18 @@ GLColor& KalziumGLWidget::getAtomColor( OpenBabel::OBAtom* atom ) c.m_green = 1.0; c.m_blue = 0.0; } + else if ( atom->GetAtomicNum() == 11 ) + {//Natrium + c.m_red = 0.2; + c.m_green = 1.0; + c.m_blue = 0.0; + } + else if ( atom->GetAtomicNum() == 17 ) + {//Chlorine + c.m_red = 0.1; + c.m_green = 0.1; + c.m_blue = 0.9; + } else { c.m_red = 0.5; diff --git a/kalzium/kalziumglwidget.h b/kalzium/kalziumglwidget.h index fec5711..8dd194b 100644 --- a/kalzium/kalziumglwidget.h +++ b/kalzium/kalziumglwidget.h @@ -123,18 +123,6 @@ class KalziumGLWidget : public QGLWidget BOND_CYLINDER_BICOLOR } m_bondStyle; - /** - * Some style presets - */ - enum StylePreset - { - PRESET_LINES, - PRESET_STICKS, - PRESET_SPHERES_AND_GRAY_BONDS, - PRESET_SPHERES_AND_BICOLOR_BONDS, - PRESET_BIG_SPHERES - }; - private: // some standard 3D math stuff here /** @@ -179,6 +167,24 @@ class KalziumGLWidget : public QGLWidget inline OpenBabel::OBMol* molecule () const { return m_molecule; } + /** + * Some style presets + */ + enum StylePreset + { + PRESET_LINES, + PRESET_STICKS, + PRESET_SPHERES_AND_GRAY_BONDS, + PRESET_SPHERES_AND_BICOLOR_BONDS, + PRESET_BIG_SPHERES + }; + + /** + * Chooses the style of rendering among some presets + * @param stylePreset the wanted style preset + */ + void ChooseStylePreset( StylePreset stylePreset ); + public slots: /** * sets the molecule which will be displayed @@ -192,10 +198,6 @@ class KalziumGLWidget : public QGLWidget */ void slotSetDetail( int detail ); - /** - * Chooses the style of rendering among some presets - * @param stylePreset the wanted style preset - */ /** * Chooses the style of rendering among some presets * @param stylePreset the wanted style preset @@ -282,12 +284,6 @@ class KalziumGLWidget : public QGLWidget inline GLFLOAT bondRadius(); inline GLFLOAT atomRadius(); - /** - * Chooses the style of rendering among some presets - * @param stylePreset the wanted style preset - */ - void ChooseStylePreset( StylePreset stylePreset ); - /** * returns the color which an atom should be painted */ -- 2.47.3