← Back to team overview

yade-dev team mailing list archive

[svn] r1651 - in trunk: gui/qt3 pkg/common/Engine/FilterEngine

 

Author: sega
Date: 2009-02-01 16:45:18 +0100 (Sun, 01 Feb 2009)
New Revision: 1651

Modified:
   trunk/gui/qt3/GLSimulationPlayerViewer.cpp
   trunk/gui/qt3/GLSimulationPlayerViewer.hpp
   trunk/gui/qt3/QtGeneratedSimulationPlayer.ui
   trunk/gui/qt3/QtSimulationPlayer.cpp
   trunk/gui/qt3/QtSimulationPlayer.hpp
   trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.cpp
   trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.hpp
Log:
1. SimulationPlayer now allows to reload filters without reloading all simulation.
2. ColorizedVelocityFilter now allows to setup minValue,maxValue without reloading the filter.


Modified: trunk/gui/qt3/GLSimulationPlayerViewer.cpp
===================================================================
--- trunk/gui/qt3/GLSimulationPlayerViewer.cpp	2009-02-01 10:04:26 UTC (rev 1650)
+++ trunk/gui/qt3/GLSimulationPlayerViewer.cpp	2009-02-01 15:45:18 UTC (rev 1651)
@@ -178,13 +178,8 @@
 		}
 	}
 	/* Filters */
-	FOREACH(shared_ptr<Engine> e, Omega::instance().getRootBody()->engines){
-		shared_ptr<FilterEngine> fe=dynamic_pointer_cast<FilterEngine>(e);
-		if(fe){
-			filters.push_back(fe);
-			simPlayer->pushMessage("Find filter: "+e->getClassName());
-		}
-	}
+    refreshFilters();
+
 	/* strided access is common for both db and file access */
 	if(stride>1){
 		list<string> xyz2;
@@ -220,7 +215,19 @@
 	updateGL();
 }
 
+void GLSimulationPlayerViewer::refreshFilters()
+{
+    filters.clear();
+	FOREACH(shared_ptr<Engine> e, Omega::instance().getRootBody()->engines){
+		shared_ptr<FilterEngine> fe=dynamic_pointer_cast<FilterEngine>(e);
+		if(fe){
+			filters.push_back(fe);
+			simPlayer->pushMessage("Find filter: "+e->getClassName());
+		}
+	}
+}
 
+
 bool GLSimulationPlayerViewer::loadNextRecordedData(){
 	if(xyzNamesIter==xyzNames.end()) return false;
 	if(!useSQLite){

Modified: trunk/gui/qt3/GLSimulationPlayerViewer.hpp
===================================================================
--- trunk/gui/qt3/GLSimulationPlayerViewer.hpp	2009-02-01 10:04:26 UTC (rev 1650)
+++ trunk/gui/qt3/GLSimulationPlayerViewer.hpp	2009-02-01 15:45:18 UTC (rev 1651)
@@ -52,6 +52,7 @@
 		void load(const string& fileName, bool fromFile=true);
 		void doOneStep();
 		void reset();
+        void refreshFilters();
 		void bodyWire(bool wire);
 	protected :
 		virtual void animate();

Modified: trunk/gui/qt3/QtGeneratedSimulationPlayer.ui
===================================================================
--- trunk/gui/qt3/QtGeneratedSimulationPlayer.ui	2009-02-01 10:04:26 UTC (rev 1650)
+++ trunk/gui/qt3/QtGeneratedSimulationPlayer.ui	2009-02-01 15:45:18 UTC (rev 1651)
@@ -626,13 +626,34 @@
                                     <property name="name">
                                         <cstring>unnamed</cstring>
                                     </property>
-                                    <widget class="QCheckBox">
+                                    <widget class="QLayoutWidget">
                                         <property name="name">
-                                            <cstring>cbAllowFiltration</cstring>
+                                            <cstring>layout6</cstring>
                                         </property>
-                                        <property name="text">
-                                            <string>Allow filtration</string>
-                                        </property>
+                                        <hbox>
+                                            <property name="name">
+                                                <cstring>unnamed</cstring>
+                                            </property>
+                                            <widget class="QCheckBox">
+                                                <property name="name">
+                                                    <cstring>cbAllowFiltration</cstring>
+                                                </property>
+                                                <property name="text">
+                                                    <string>Allow filtration</string>
+                                                </property>
+                                            </widget>
+                                            <widget class="QPushButton">
+                                                <property name="name">
+                                                    <cstring>pbRefreshFilters</cstring>
+                                                </property>
+                                                <property name="text">
+                                                    <string></string>
+                                                </property>
+                                                <property name="pixmap">
+                                                    <pixmap>image0</pixmap>
+                                                </property>
+                                            </widget>
+                                        </hbox>
                                     </widget>
                                     <spacer>
                                         <property name="name">
@@ -821,6 +842,12 @@
         <receiver>QtGeneratedSimulationPlayer</receiver>
         <slot>cbBodyWireToggled(bool)</slot>
     </connection>
+    <connection>
+        <sender>pbRefreshFilters</sender>
+        <signal>clicked()</signal>
+        <receiver>QtGeneratedSimulationPlayer</receiver>
+        <slot>pbRefreshFiltersClicked()</slot>
+    </connection>
 </connections>
 <signals>
     <signal>closeSignal()</signal>
@@ -837,6 +864,7 @@
     <slot>cbSaveSnapShotsToggled(bool)</slot>
     <slot>cbAllowFiltrationToggled(bool)</slot>
     <slot>cbBodyWireToggled(bool)</slot>
+    <slot>pbRefreshFiltersClicked()</slot>
 </slots>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>

Modified: trunk/gui/qt3/QtSimulationPlayer.cpp
===================================================================
--- trunk/gui/qt3/QtSimulationPlayer.cpp	2009-02-01 10:04:26 UTC (rev 1650)
+++ trunk/gui/qt3/QtSimulationPlayer.cpp	2009-02-01 15:45:18 UTC (rev 1651)
@@ -42,6 +42,7 @@
 void QtSimulationPlayer::pbResetClicked(){ setParameters();	glSimulationPlayerViewer->reset();}
 void QtSimulationPlayer::cbSaveSnapShotsToggled(bool b){	glSimulationPlayerViewer->saveSnapShots=b;}
 void QtSimulationPlayer::cbAllowFiltrationToggled(bool b){	FilterEngine::isFiltrationActivated=b; }
+void QtSimulationPlayer::pbRefreshFiltersClicked(){	glSimulationPlayerViewer->refreshFilters(); }
 void QtSimulationPlayer::cbBodyWireToggled(bool b){	glSimulationPlayerViewer->bodyWire(b); }
 void QtSimulationPlayer::closeEvent(QCloseEvent *e){ QtGeneratedSimulationPlayer::closeEvent(e); emit closeSignal(); }
 

Modified: trunk/gui/qt3/QtSimulationPlayer.hpp
===================================================================
--- trunk/gui/qt3/QtSimulationPlayer.hpp	2009-02-01 10:04:26 UTC (rev 1650)
+++ trunk/gui/qt3/QtSimulationPlayer.hpp	2009-02-01 15:45:18 UTC (rev 1651)
@@ -41,6 +41,7 @@
 		virtual void pbResetClicked();
 		
 		virtual void cbAllowFiltrationToggled(bool b);
+        virtual void pbRefreshFiltersClicked();
 		
 		virtual void cbBodyWireToggled(bool b);
  	

Modified: trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.cpp
===================================================================
--- trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.cpp	2009-02-01 10:04:26 UTC (rev 1650)
+++ trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.cpp	2009-02-01 15:45:18 UTC (rev 1651)
@@ -16,7 +16,7 @@
 	autoScale=true;
 	minValue=0;
 	maxValue=0;
-	midValue=0;
+	//midValue=0;
 	onlyDynamic=true;
 	prevPositions.clear();
 	prevIteration=0;
@@ -69,6 +69,7 @@
 Vector3r ColorizedVelocityFilter::getColor4Value(Real v)
 {
 	Vector3r color;
+	Real midValue = (minValue+maxValue)/2;
 	if (v<midValue) 
 	{
 		color[0] = 0;
@@ -93,9 +94,9 @@
 		if (values[i]<minValue) minValue = values[i];
 		if (values[i]>maxValue) maxValue = values[i];
 	}
-	midValue = (minValue+maxValue)/2;
+	//midValue = (minValue+maxValue)/2;
 	
-	LOG_INFO("minValue:" << minValue << '\t' << "maxValue:" << maxValue << '\t' << "midValue:" << midValue);
+	LOG_INFO("minValue:" << minValue << '\t' << "maxValue:" << maxValue /*<< '\t' << "midValue:" << midValue*/);
 }
 
 void ColorizedVelocityFilter::initialize(MetaBody* ncb)
@@ -116,12 +117,12 @@
 	for(int i=0,e=subscrBodies.size(); i<e; ++i)
 		prevPositions[i] = (*bodies)[subscrBodies[i]]->physicalParameters->se3.position;
 	
-	midValue = (minValue+maxValue)/2;
+	//midValue = (minValue+maxValue)/2;
 	
 	dt = Omega::instance().getTimeStep();
 	prevIteration = Omega::instance().getCurrentIteration();
 
-	LOG_INFO("bodies:" << subscrBodies.size() << '\t' << "minValue:" << minValue << '\t' << "maxValue:" << maxValue << '\t' << "midValue:" << midValue);
+	LOG_INFO("bodies:" << subscrBodies.size() << '\t' << "minValue:" << minValue << '\t' << "maxValue:" << maxValue /*<< '\t' << "midValue:" << midValue*/);
 }
 
 

Modified: trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.hpp
===================================================================
--- trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.hpp	2009-02-01 10:04:26 UTC (rev 1650)
+++ trunk/pkg/common/Engine/FilterEngine/ColorizedVelocityFilter.hpp	2009-02-01 15:45:18 UTC (rev 1651)
@@ -13,7 +13,7 @@
 
 class ColorizedVelocityFilter : public FilterEngine {
 	protected:
-		Real midValue;
+		//Real midValue;
 		vector<Vector3r> prevPositions;
 		long int prevIteration;
 		Real dt;




Follow ups