]> Git trees. - libqmvoc.git/commitdiff
This way we can test with real testfiles. Only problem: The path is still hardcoded
authorCarsten Niehaus <cniehaus@gmx.de>
Mon, 12 Jun 2006 17:02:10 +0000 (17:02 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Mon, 12 Jun 2006 17:02:10 +0000 (17:02 +0000)
svn path=/trunk/KDE/kdeedu/kalzium/src/kalziumglwidget.cpp; revision=550760

kalzium/kalziumglwidget.cpp

index 9cb8b44cb9a03c0369dbb160118d9d382f66bc30..4dee5d7c666fb12c5939a23c1cc65bc3bb9cd74d 100644 (file)
 
 #include <kdebug.h>
 
+
 #include <QMouseEvent>
 #include <QListWidget>
 
+#include "openbabel2wrapper.h"
+#include <openbabel/mol.h>
+#include <openbabel/obiter.h>
+
+using namespace OpenBabel;
+
 KalziumGLWidget::KalziumGLWidget( QWidget * parent )
        : QGLWidget( parent )
 {
@@ -77,13 +84,21 @@ void KalziumGLWidget::initializeGL()
 
 void KalziumGLWidget::paintGL()
 {
+       if ( !m_molecule )
+               return;
+       
        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
        glLoadIdentity();
        glTranslated( 0.0, 0.0, -12.0);
        glMultMatrixd( RotationMatrix );
-       drawSphere(1.0, -1.0, -2.0, 1.5, 1.0, 0.0, 0.0);
-       drawSphere(-2.0, 1.0, 1.0, 2.5, 0.0, 1.0, 0.0);
-       drawSphere(2.0, 0.5, 0.0, 1.0, 0.0, 0.0, 1.0);
+
+       FOR_ATOMS_OF_MOL( a, m_molecule )
+       {
+               GLdouble x = ( GLdouble )a->GetX();
+               GLdouble y = ( GLdouble )a->GetY();
+               GLdouble z = ( GLdouble )a->GetZ();
+               drawSphere(x,y,z,1.0, 1.0, 0.0, 0.0);
+       }
 }
 
 void KalziumGLWidget::resizeGL( int width, int height )