[Kalzium] KDE/kdeedu/kalzium/src

Carsten Niehaus cniehaus at gmx.de
Sat Jun 24 16:16:58 CEST 2006


SVN commit 554591 by cniehaus:

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 at kde.org


 M  +12 -0     kalziumglwidget.cpp  
 M  +18 -22    kalziumglwidget.h  
 M  +3 -0      latticedialog.cpp  
 A             test.cml  


--- trunk/KDE/kdeedu/kalzium/src/kalziumglwidget.cpp #554590:554591
@@ -652,6 +652,18 @@
 		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;
--- trunk/KDE/kdeedu/kalzium/src/kalziumglwidget.h #554590:554591
@@ -123,18 +123,6 @@
 			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 @@
 		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
@@ -196,10 +202,6 @@
 		 * 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
-		 */
 		void slotChooseStylePreset( int stylePreset ){
 			ChooseStylePreset( (StylePreset) stylePreset );
 		}
@@ -283,12 +285,6 @@
 		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
 		 */
 
--- trunk/KDE/kdeedu/kalzium/src/latticedialog.cpp #554590:554591
@@ -59,6 +59,8 @@
 
 	connect( ui.updateButton, SIGNAL( clicked() ), 
 			this, SLOT( slotUpdateView() ) );
+	
+	slotUpdateView();
 }
 
 void LatticeDialog::slotUpdateView()
@@ -67,6 +69,7 @@
 	double volume = m_unitCell->GetCellVolume();
 	ui.volumeLabel->setText( QString::number( volume ) );
 	ui.glWidget->slotSetMolecule( m_molecule );
+//	ui.glWidget->ChooseStylePreset( KalziumGLWidget::PRESET_LINES  );
 	ui.glWidget->update();
 }
 


More information about the Kalzium mailing list