ModifyObject.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This program is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU General Public License as published by the Free  *
00007 * Software Foundation; either version 2 of the License, or (at your option)   *
00008 * any later version.                                                          *
00009 *                                                                             *
00010 * This program is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    *
00013 * more details.                                                               *
00014 *                                                                             *
00015 * You should have received a copy of the GNU General Public License along     *
00016 * with this program; if not, write to the Free Software Foundation, Inc., 51  *
00017 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.                   *
00018 *******************************************************************************
00019 *                            SOFA :: Applications                             *
00020 *                                                                             *
00021 * Authors: M. Adam, J. Allard, B. Andre, P-J. Bensoussan, S. Cotin, C. Duriez,*
00022 * H. Delingette, F. Falipou, F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza,  *
00023 * M. Nesme, P. Neumann, J-P. de la Plata Alcade, F. Poyer and F. Roy          *
00024 *                                                                             *
00025 * Contact information: contact@sofa-framework.org                             *
00026 ******************************************************************************/
00027 
00028 #include <sofa/gui/qt/ModifyObject.h>
00029 #include <iostream> 
00030 #ifdef SOFA_QT4
00031 #include <QLineEdit>
00032 #include <QPushButton>
00033 #include <QLabel>
00034 #include <QCheckBox>
00035 #include <QHBoxLayout>
00036 #include <QVBoxLayout>
00037 #include <QTabWidget>
00038 #include <QGridLayout> 
00039 #include <Q3Grid>
00040 #include <QTabWidget>
00041 #include <Q3ListView>
00042 #else
00043 #include <qlineedit.h>
00044 #include <qpushbutton.h>
00045 #include <qlabel.h>
00046 #include <qcheckbox.h>
00047 #include <qlayout.h>
00048 #include <qtabwidget.h>
00049 #include <qgrid.h>
00050 #endif
00051 
00052 #include <sofa/component/topology/PointSubset.h>
00053 #include <sofa/defaulttype/VecTypes.h>
00054 #include <sofa/defaulttype/RigidTypes.h>
00055 #include <sofa/defaulttype/LaparoscopicRigidTypes.h>
00056 #include <sofa/helper/io/Mesh.h>
00057 #include <sofa/core/ObjectFactory.h>
00058 
00059 #include <sofa/simulation/common/InitVisitor.h>
00060 #include <sofa/simulation/common/UpdateContextVisitor.h>
00061 #include <sofa/simulation/common/TransformationVisitor.h>
00062 
00063 
00064 
00065 #include <qwt_legend.h>
00066 
00067 #if !defined(INFINITY)
00068 #define INFINITY 9.0e10
00069 #endif
00070 
00071 
00072 #define WIDGET_BY_TAB 10
00073 #define SIZE_TEXT     75 
00074 
00075 namespace sofa
00076 {
00077  
00078   namespace gui
00079   {
00080 
00081     namespace qt
00082     {
00083 
00084       using namespace  sofa::defaulttype;
00085       using sofa::component::topology::PointSubset;
00086       using sofa::core::objectmodel::BaseData;
00087 
00088 #ifndef SOFA_QT4
00089       typedef QGrid       Q3Grid;
00090       typedef QScrollView Q3ScrollView;
00091 #endif
00092 
00093 
00094       ModifyObject::ModifyObject(void *Id_, core::objectmodel::Base* node_clicked, Q3ListViewItem* item_clicked,  QWidget* parent_, const char* name, bool, Qt::WFlags // f
00095                  ):
00096     parent(parent_), node(NULL), Id(Id_),visualContentModified(false)
00097       {
00098     //Title of the Dialog
00099     setCaption(name);
00100 
00101     HIDE_FLAG = true;
00102     EMPTY_FLAG = false;
00103     RESIZABLE_FLAG = false;
00104     REINIT_FLAG = true;
00105 
00106     energy_curve[0]=NULL;           energy_curve[1]=NULL;           energy_curve[2]=NULL;
00107     //Initialization of the Widget
00108     setNode(node_clicked, item_clicked);
00109     connect ( this, SIGNAL( objectUpdated() ), parent_, SLOT( redraw() ));
00110     connect ( this, SIGNAL( dialogClosed(void *) ) , parent_, SLOT( modifyUnlock(void *)));
00111 
00112 
00113       }
00114 
00115 
00116       //Set the default file
00117       void ModifyObject::setNode(core::objectmodel::Base* node_clicked, Q3ListViewItem* item_clicked)
00118       {
00119     node = node_clicked;
00120     item = item_clicked;
00121     //Layout to organize the whole window
00122     QVBoxLayout *generalLayout = new QVBoxLayout(this, 0, 1, "generalLayout");
00123 
00124     //Tabulation widget
00125     dialogTab = new QTabWidget(this);
00126     generalLayout->addWidget(dialogTab);
00127     connect(dialogTab, SIGNAL( currentChanged( QWidget*)), this, SLOT( updateTables()));
00128 
00129     //Each tab
00130         counterWidget=0;
00131 
00132         unsigned int counterTab=0;
00133     QWidget *currentTab=NULL;
00134     QWidget *currentTab_save=NULL;
00135         bool emptyTab = false;
00136         
00137         
00138     bool visualTab = false;
00139     QWidget *tabVisualization = NULL; //tab for visualization info: only created if needed ( boolean visualTab gives this answer ).
00140 
00141     QVBoxLayout *currentTabLayout = NULL;
00142     QVBoxLayout *tabPropertiesLayout=NULL;
00143     QVBoxLayout *tabVisualizationLayout = NULL;
00144 
00145     // displayWidget
00146     if (node_clicked)
00147       {
00148         //If the current element is a node, we add a box to perform geometric transformation: translation, rotation, scaling
00149         if(dynamic_cast< Node *>(node_clicked)) 
00150           {
00151         emptyTab = false;
00152         currentTab_save  = currentTab= new QWidget();   
00153         currentTabLayout = tabPropertiesLayout = new QVBoxLayout( currentTab, 0, 1, QString("tabPropertiesLayout") + QString::number(counterWidget));         
00154         counterWidget = 2;
00155 
00156         dialogTab->addTab(currentTab, QString("Properties ") + QString::number(counterWidget/WIDGET_BY_TAB));
00157         ++counterTab;
00158 
00159         Q3GroupBox *box = new Q3GroupBox(currentTab, QString("Transformation"));
00160         box->setColumns(4);
00161         box->setTitle(QString("Transformation"));
00162         //********************************************************************************
00163         //Translation
00164         new QLabel(QString("Translation"), box);
00165         transformation[0] = new WFloatLineEdit( box, "editTranslationX" );
00166         transformation[0]->setMinFloatValue( (float)-INFINITY );
00167         transformation[0]->setMaxFloatValue( (float)INFINITY );
00168 
00169         transformation[1] = new WFloatLineEdit( box, "transformation[1]" );
00170         transformation[1]->setMinFloatValue( (float)-INFINITY );
00171         transformation[1]->setMaxFloatValue( (float)INFINITY );
00172 
00173         transformation[2] = new WFloatLineEdit( box, "transformation[2]" );
00174         transformation[2]->setMinFloatValue( (float)-INFINITY );
00175         transformation[2]->setMaxFloatValue( (float)INFINITY );    
00176         
00177         
00178         //********************************************************************************
00179         //Rotation
00180         new QLabel(QString("Rotation"), box);
00181         transformation[3] = new WFloatLineEdit( box, "transformation[3]" );
00182         transformation[3]->setMinFloatValue( (float)-INFINITY );
00183         transformation[3]->setMaxFloatValue( (float)INFINITY );
00184 
00185         transformation[4] = new WFloatLineEdit( box, "transformation[4]" );
00186         transformation[4]->setMinFloatValue( (float)-INFINITY );
00187         transformation[4]->setMaxFloatValue( (float)INFINITY );
00188 
00189         transformation[5] = new WFloatLineEdit( box, "transformation[5]" );
00190         transformation[5]->setMinFloatValue( (float)-INFINITY );
00191         transformation[5]->setMaxFloatValue( (float)INFINITY );  
00192         
00193         
00194         //********************************************************************************
00195         //Scale
00196         QLabel *textScale = new QLabel(QString("Scale"), box);
00197         transformation[6] = new WFloatLineEdit( box, "transformation[6]" );
00198         transformation[6]->setMinFloatValue( (float)-INFINITY );
00199         transformation[6]->setMaxFloatValue( (float)INFINITY );
00200 
00201         
00202         //********************************************************************************
00203         //Default values
00204         transformation[0]->setFloatValue(0);
00205         transformation[1]->setFloatValue(0);
00206         transformation[2]->setFloatValue(0);    
00207             
00208         transformation[3]->setFloatValue(0);
00209         transformation[4]->setFloatValue(0);
00210         transformation[5]->setFloatValue(0);      
00211         
00212         transformation[6]->setFloatValue(1);
00213 
00214         connect( transformation[0], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00215         connect( transformation[1], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00216         connect( transformation[2], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00217         connect( transformation[3], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00218         connect( transformation[4], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00219         connect( transformation[5], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00220         connect( transformation[6], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00221 
00222         //Option still experimental : disabled !!!!
00223         textScale->hide();
00224         transformation[6]->hide();
00225 
00226 
00227         tabPropertiesLayout->addWidget( box );
00228           }
00229 
00230         //All the pointers to the QObjects will be kept in memory in list_Object
00231 
00232         const std::vector< std::pair<std::string, BaseData*> >& fields = node->getFields();
00233 
00234         int i=0;
00235         for( std::vector< std::pair<std::string, BaseData*> >::const_iterator it = fields.begin();it!=fields.end();++it)
00236           {
00237         currentTab = currentTab_save; //in case we modified currentTab to the visualTab
00238         currentTabLayout = tabPropertiesLayout;
00239                 if (!emptyTab && counterWidget/WIDGET_BY_TAB==counterTab)
00240           {
00241             emptyTab = true;
00242             if (tabPropertiesLayout!= NULL) tabPropertiesLayout->addStretch();          
00243             currentTab_save  = currentTab= new QWidget();   
00244             currentTabLayout = tabPropertiesLayout = new QVBoxLayout( currentTab, 0, 1, QString("tabPropertiesLayout") + QString::number(counterWidget));         
00245           }
00246         //For each element, we create a layout
00247         std::ostringstream oss;
00248         oss << "itemLayout_" << i;
00249         Q3GroupBox *box = NULL;;
00250         // The label
00251         //QLabel *label = new QLabel(QString((*it).first.c_str()), box,0);
00252         //label->setGeometry( 10, i*25+5, 200, 20 );
00253 
00254         //      const std::string& fieldname = (*it).second->getValueTypeString();
00255         std::string name((*it).first);
00256         name.resize(4);
00257         if (name == "show")
00258           {         
00259             if (!visualTab && dynamic_cast< Data<int> * >( (*it).second ) 
00260             && 
00261                 (
00262              (*it).first == "showVisualModels" || 
00263              (*it).first == "showBehaviorModels" || 
00264              (*it).first == "showCollisionModels" || 
00265              (*it).first == "showBoundingCollisionModels" || 
00266              (*it).first == "showMappings" || 
00267              (*it).first == "showMechanicalMappings" || 
00268              (*it).first == "showForceFields" || 
00269              (*it).first == "showInteractionForceFields" || 
00270              (*it).first == "showWireFrame" ||
00271              (*it).first == "showNormals" 
00272              )
00273             )             
00274               {
00275             
00276             visualTab = true;
00277             tabVisualization = new QWidget();
00278                   
00279             tabVisualizationLayout = new QVBoxLayout( tabVisualization, 0, 1, "tabVisualizationLayout");    
00280             
00281 
00282             box = new Q3GroupBox(tabVisualization, QString("Tri State"));
00283             tabVisualizationLayout->addWidget( box );
00284 
00285             box->setColumns(2);
00286             box->setTitle(QString("Visualization Flags"));
00287 
00288             displayFlag = new DisplayFlagWidget(box);
00289             
00290             connect( displayFlag, SIGNAL( change(int,bool)), this, SLOT(changeVisualValue() ));
00291 
00292               Data<int> *ff;
00293  
00294               for (unsigned int i=0;i<10;++i)
00295                 {
00296                   ff=dynamic_cast< Data<int> * >( (*it).second);
00297                   objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) displayFlag));
00298                   if (i!=0) displayFlag->setFlag(i,(ff->getValue()==1));
00299                   else      displayFlag->setFlag(i,(ff->getValue()!=0));
00300                   it++;
00301                 }
00302             it--;
00303             continue;
00304               }          
00305           }
00306         
00307         {
00308 
00309           std::string box_name(oss.str());
00310           box = new Q3GroupBox(currentTab, QString(box_name.c_str()));
00311           box->setColumns(4);
00312           box->setTitle(QString((*it).first.c_str()));
00313           if (hideData(it->second))  box->hide();
00314 
00315           std::string label_text=(*it).second->help;
00316 
00317           std::string final_text;
00318           unsigned int number_line=0;
00319           while (!label_text.empty())
00320             {
00321               std::string::size_type pos = label_text.find('\n');
00322               std::string current_sentence;
00323               if (pos != std::string::npos) 
00324             current_sentence  = label_text.substr(0,pos+1);
00325               else  
00326             current_sentence = label_text;
00327             
00328 
00329               if (current_sentence.size() > SIZE_TEXT)
00330             { 
00331               unsigned int index_cut;
00332               unsigned int cut = current_sentence.size()/SIZE_TEXT;
00333               for (index_cut=1;index_cut<=cut;index_cut++)
00334                 {
00335                   std::string::size_type numero_char=current_sentence.rfind(' ',SIZE_TEXT*index_cut);
00336                   current_sentence = current_sentence.insert(numero_char+1,1,'\n');
00337                   number_line++;
00338                 }
00339             }
00340               if (pos != std::string::npos) label_text = label_text.substr(pos+1);          
00341               else label_text = "";
00342               final_text += current_sentence;
00343               number_line++;
00344             }
00345           counterWidget += number_line/3; //each 3lines, a new widget is counted
00346           if (label_text != "TODO") new QLabel(final_text.c_str(), box);
00347          
00348           //********************************************************************************************************//
00349           //int
00350           if( Data<int> * ff = dynamic_cast< Data<int> * >( (*it).second )  )
00351             {                           
00352               QSpinBox* spinBox = new QSpinBox((int)INT_MIN,(int)INT_MAX,1,box);
00353               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) spinBox));
00354 
00355               spinBox->setValue(ff->getValue());
00356               connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( changeValue() ) );
00357             }
00358           //********************************************************************************************************//
00359           //char
00360           else if( Data<bool> * ff = dynamic_cast< Data<bool> * >( (*it).second )  )
00361             {
00362               QCheckBox* checkBox = new QCheckBox(box);
00363               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));
00364 
00365               checkBox->setChecked(ff->getValue());
00366               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );
00367             }
00368           //********************************************************************************************************//
00369           //unsigned int
00370           else if( Data<unsigned int> * ff = dynamic_cast< Data<unsigned int> * >( (*it).second )  )
00371             {
00372               QSpinBox* spinBox = new QSpinBox((int)0,(int)INT_MAX,1,box);
00373               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) spinBox));
00374 
00375               spinBox->setValue(ff->getValue());
00376               connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( changeValue() ) );
00377             }
00378           //********************************************************************************************************//
00379           //float
00380           else if( Data<float> * ff = dynamic_cast< Data<float> * >( (*it).second )  )
00381             {             
00382               WFloatLineEdit* editSFFloat = new WFloatLineEdit( box, "editSFFloat" );
00383               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editSFFloat));
00384 
00385               editSFFloat->setMinFloatValue( (float)-INFINITY );
00386               editSFFloat->setMaxFloatValue( (float)INFINITY );
00387 
00388               editSFFloat->setFloatValue(ff->getValue());
00389               connect( editSFFloat, SIGNAL( textChanged(const QString &) ), this, SLOT( changeValue() ) );
00390             }
00391           //********************************************************************************************************//
00392           //double
00393           else if(Data<double> * ff = dynamic_cast< Data<double> * >( (*it).second )  )
00394             {             
00395               WFloatLineEdit* editSFFloat = new WFloatLineEdit( box, "editSFFloat" );
00396               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editSFFloat));
00397 
00398               editSFFloat->setMinFloatValue( (float)-INFINITY );
00399               editSFFloat->setMaxFloatValue( (float)INFINITY );
00400 
00401               editSFFloat->setFloatValue(ff->getValue());
00402               connect( editSFFloat, SIGNAL( textChanged(const QString &) ), this, SLOT( changeValue() ) );
00403             }
00404           //********************************************************************************************************//
00405           //string
00406           else if( Data<std::string> * ff = dynamic_cast< Data<std::string> * >( (*it).second )  )
00407             {
00408               //            if (ff->getValue().empty()) continue;
00409               QLineEdit* lineEdit = new QLineEdit(box);
00410               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) lineEdit));
00411 
00412               lineEdit->setText(QString(ff->getValue().c_str()));
00413               connect( lineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00414             }
00415           //********************************************************************************************************//
00416           //int
00417           else if( DataPtr<int> * ff = dynamic_cast< DataPtr<int> * >( (*it).second )  )
00418             {                           
00419               QSpinBox* spinBox = new QSpinBox((int)INT_MIN,(int)INT_MAX,1,box);
00420               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) spinBox));
00421 
00422               spinBox->setValue(ff->getValue());
00423               connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( changeValue() ) );
00424             }
00425           //********************************************************************************************************//
00426           //unsigned int
00427           else if( DataPtr<unsigned int> * ff = dynamic_cast< DataPtr<unsigned int> * >( (*it).second )  )
00428             {
00429               QSpinBox* spinBox = new QSpinBox((int)0,(int)INT_MAX,1,box);
00430               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) spinBox));
00431 
00432               spinBox->setValue(ff->getValue());
00433               connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( changeValue() ) );
00434             }   
00435           //********************************************************************************************************//
00436           //char
00437           else if( DataPtr<bool> * ff = dynamic_cast< DataPtr<bool> * >( (*it).second )  )
00438             {
00439               QCheckBox* checkBox = new QCheckBox(box);
00440               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));
00441 
00442               checkBox->setChecked(ff->getValue());
00443               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );
00444             }
00445           //********************************************************************************************************//
00446           //float
00447           else if( DataPtr<float> * ff = dynamic_cast< DataPtr<float> * >( (*it).second )  )
00448             {           
00449               WFloatLineEdit* editSFFloat = new WFloatLineEdit( box, "editSFFloat" );
00450               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editSFFloat));
00451 
00452               editSFFloat->setMinFloatValue( (float)-INFINITY );
00453               editSFFloat->setMaxFloatValue( (float)INFINITY );
00454 
00455               editSFFloat->setFloatValue(ff->getValue());
00456               connect( editSFFloat, SIGNAL( textChanged(const QString &) ), this, SLOT( changeValue() ) );
00457             }
00458           //********************************************************************************************************//
00459           //double
00460           else if(DataPtr<double> * ff = dynamic_cast< DataPtr<double> * >( (*it).second )  )
00461             {             
00462               WFloatLineEdit* editSFFloat = new WFloatLineEdit( box, "editSFFloat" );
00463               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editSFFloat));
00464 
00465               editSFFloat->setMinFloatValue( (float)-INFINITY );
00466               editSFFloat->setMaxFloatValue( (float)INFINITY );
00467 
00468               editSFFloat->setFloatValue(ff->getValue());
00469               connect( editSFFloat, SIGNAL( textChanged(const QString &) ), this, SLOT( changeValue() ) );
00470             }
00471           //********************************************************************************************************//
00472           //string
00473           else if( DataPtr<std::string> * ff = dynamic_cast< DataPtr<std::string> * >( (*it).second )  )
00474             {
00475               //            if (ff->getValue().empty()) continue;
00476               QLineEdit* lineEdit = new QLineEdit(box);
00477               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) lineEdit));
00478 
00479               lineEdit->setText(QString(ff->getValue().c_str()));
00480               connect( lineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00481             }
00482           else if(DataPtr<bool> *ff = dynamic_cast< DataPtr< bool> * > ( (*it).second) )
00483             {
00484               QCheckBox* checkBox = new QCheckBox(box);
00485               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));
00486 
00487               checkBox->setChecked(ff->getValue());
00488               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );               
00489             }
00490           //********************************************************************************************************//
00491           //Vec6f, Vec6d
00492           else if( dynamic_cast< Data<Vec6f> * > ( (*it).second ) ||
00493                dynamic_cast< Data<Vec6d> * > ( (*it).second ) || 
00494                dynamic_cast< Data<Vec<6,int> > *> ( (*it).second ) || 
00495                dynamic_cast< Data<Vec<6,unsigned int> >* > ( (*it).second ) )
00496             {
00497  
00498               if( Data<Vec6f> * ff = dynamic_cast< Data<Vec6f> * >( (*it).second )  )
00499             { 
00500               createVector(  (*it).second ,ff->getValue(), box);
00501             }
00502               else if(Data<Vec6d> * ff = dynamic_cast< Data<Vec6d> * >( (*it).second )  )
00503             {
00504               createVector(  (*it).second ,ff->getValue(), box);
00505             }
00506               else if(Data<Vec<6,int> > * ff = dynamic_cast< Data<Vec<6,int> >* >( (*it).second )  )
00507             {
00508               createVector(  (*it).second ,ff->getValue(), box);
00509             }
00510               else if(Data<Vec<6,unsigned int> > * ff = dynamic_cast< Data<Vec<6,unsigned int> >* >( (*it).second )  )
00511             {
00512               createVector(  (*it).second ,ff->getValue(), box);
00513             }
00514             }
00515           //********************************************************************************************************//
00516           //Vec4f,Vec4d
00517           else if( dynamic_cast< Data<Vec4f> * >( (*it).second ) ||
00518                dynamic_cast< Data<Vec4d> * >( (*it).second ) || 
00519                dynamic_cast< Data<Vec<4,int> > *>( (*it).second ) || 
00520                dynamic_cast< Data<Vec<4,unsigned int> >* >  ( (*it).second )  )
00521             {           
00522 
00523 
00524               if( Data<Vec4f> * ff = dynamic_cast< Data<Vec4f> * >( (*it).second )  )
00525             {
00526               createVector(  (*it).second ,ff->getValue(), box);
00527             }
00528               else if(Data<Vec4d> * ff = dynamic_cast< Data<Vec4d> * >( (*it).second )  )
00529             {
00530               createVector(  (*it).second ,ff->getValue(), box);
00531             }
00532               else if(Data<Vec<4,int> > * ff = dynamic_cast< Data<Vec<4,int> >* >( (*it).second )  )
00533             {
00534               createVector(  (*it).second ,ff->getValue(), box);
00535             }
00536               else if(Data<Vec<4,unsigned int> > * ff = dynamic_cast< Data<Vec<4,unsigned int> >* >( (*it).second )  )
00537             {
00538               createVector(  (*it).second ,ff->getValue(), box);
00539             }
00540             }
00541           //********************************************************************************************************//
00542           //Vec3f,Vec3d
00543           else if( dynamic_cast< Data<Vec3f> * >( (*it).second ) ||
00544                dynamic_cast< Data<Vec3d> * >( (*it).second ) || 
00545                dynamic_cast< Data<Vec<3,int> > *>( (*it).second ) || 
00546                dynamic_cast< Data<Vec<3,unsigned int> >* >  ( (*it).second ))
00547             {
00548             
00549               if( Data<Vec3f> * ff = dynamic_cast< Data<Vec3f> * >( (*it).second )  )
00550             {
00551               createVector(  (*it).second ,ff->getValue(), box);
00552             }
00553               else if(Data<Vec3d> * ff = dynamic_cast< Data<Vec3d> * >( (*it).second )  )
00554             {
00555               createVector(  (*it).second ,ff->getValue(), box);
00556             }
00557               else if(Data<Vec<3,int> > * ff = dynamic_cast< Data<Vec<3,int> >* >( (*it).second )  )
00558             {
00559               createVector(  (*it).second ,ff->getValue(), box);
00560             }
00561               else if(Data<Vec<3,unsigned int> > * ff = dynamic_cast< Data<Vec<3,unsigned int> >* >( (*it).second )  )
00562             {
00563               createVector(  (*it).second ,ff->getValue(), box);
00564             }
00565 
00566             }
00567           //********************************************************************************************************//
00568           //Vec2f,Vec2d
00569           else if( dynamic_cast< Data<Vec2f> * >( (*it).second ) ||
00570                dynamic_cast< Data<Vec2d> * >( (*it).second ) || 
00571                dynamic_cast< Data<Vec<2,int> > * >( (*it).second ) || 
00572                dynamic_cast< Data<Vec<2,unsigned int> > * >  ( (*it).second ))
00573             {
00574 
00575 
00576               if( Data<Vec2f> * ff = dynamic_cast< Data<Vec2f> * >( (*it).second )  )
00577             {
00578               createVector(  (*it).second ,ff->getValue(), box);
00579             }
00580               else if(Data<Vec2d> * ff = dynamic_cast< Data<Vec2d> * >( (*it).second )  )
00581             {
00582               createVector(  (*it).second ,ff->getValue(), box);
00583             }
00584               else if(Data<Vec<2,int> > * ff = dynamic_cast< Data<Vec<2,int> >* >( (*it).second )  )
00585             {
00586               createVector(  (*it).second ,ff->getValue(), box);
00587             }
00588               else if(Data<Vec<2,unsigned int> > * ff = dynamic_cast< Data<Vec<2,unsigned int> >* >( (*it).second )  )
00589             {
00590               createVector(  (*it).second ,ff->getValue(), box);
00591             }
00592 
00593             }
00594           //********************************************************************************************************//
00595           //Vec1f,Vec1d
00596           else if( dynamic_cast< Data<Vec1f> * >( (*it).second ) || 
00597                dynamic_cast< Data<Vec1d> * >( (*it).second ) || 
00598                dynamic_cast< Data<Vec<1,int> > * >( (*it).second ) || 
00599                dynamic_cast< Data<Vec<1,unsigned int> > *  > ( (*it).second ))
00600             {             
00601               if( Data<Vec1f> * ff = dynamic_cast< Data<Vec1f> * >( (*it).second )  )
00602             {
00603               createVector(  (*it).second ,ff->getValue(), box);
00604             }
00605               else if(Data<Vec1d> * ff = dynamic_cast< Data<Vec1d> * >( (*it).second )  )
00606             {
00607               createVector(  (*it).second ,ff->getValue(), box);
00608             }
00609               else if(Data<Vec<1,int> > * ff = dynamic_cast< Data<Vec<1,int> > * >( (*it).second )  )
00610             {
00611               createVector(  (*it).second ,ff->getValue(), box);
00612             }
00613               else if(Data<Vec<1,unsigned int> > * ff = dynamic_cast< Data<Vec<1,unsigned int> > * >( (*it).second )  )
00614             {
00615               createVector(  (*it).second ,ff->getValue(), box);
00616             }
00617             }
00618           //********************************************************************************************************//
00619           //PointSubset
00620           else if( Data<PointSubset> * ff = dynamic_cast< Data<PointSubset> * >( (*it).second )  )
00621             {
00622               Q3Table *vectorTable=NULL;
00623               
00624               box->setColumns(1);
00625               
00626               vectorTable = addResizableTable(box,ff->getValue().size(),1);
00627               
00628               list_Table.push_back(std::make_pair(vectorTable, ff));
00629               objectGUI.push_back(std::make_pair(ff,vectorTable));
00630               vectorTable->horizontalHeader()->setLabel(0,QString("Value"));
00631               vectorTable->setColumnStretchable(0,true);
00632               
00633               connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
00634               
00635               
00636               if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
00637               else    vectorTable->setNumRows(ff->getValue().size());
00638               
00639                                       
00640               //Get the PointSubset from the Data
00641               PointSubset p= ff->getValue();
00642 
00643               for (unsigned int i=0; i<ff->getValue().size(); i++)
00644             {
00645               std::ostringstream oss;
00646               oss << p[i];
00647               vectorTable->setText(i,0,std::string(oss.str()).c_str());
00648             }
00649             }       
00650           //********************************************************************************************************//
00651           //PointSubset
00652           else if( DataPtr<PointSubset> * ff = dynamic_cast< DataPtr<PointSubset> * >( (*it).second )  )
00653             {
00654               Q3Table *vectorTable=NULL;
00655               
00656               box->setColumns(1);
00657               
00658               vectorTable = addResizableTable(box,ff->getValue().size(),1);
00659               
00660               list_Table.push_back(std::make_pair(vectorTable, ff));
00661               objectGUI.push_back(std::make_pair(ff,vectorTable));
00662               vectorTable->horizontalHeader()->setLabel(0,QString("Value"));
00663               vectorTable->setColumnStretchable(0,true);
00664               
00665               connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
00666               
00667               
00668               if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
00669               else    vectorTable->setNumRows(ff->getValue().size());
00670               
00671                                       
00672               //Get the PointSubset from the Data
00673               PointSubset p= ff->getValue();
00674 
00675               for (unsigned int i=0; i<ff->getValue().size(); i++)
00676             {
00677               std::ostringstream oss;
00678               oss << p[i];
00679               vectorTable->setText(i,0,std::string(oss.str()).c_str());
00680             }
00681             }
00682           //********************************************************************************************************//
00683           //RigidMass<3, double>,RigidMass<3, float> 
00684           else if( dynamic_cast< Data<RigidMass<3, double> > * >( (*it).second ) ||
00685                dynamic_cast< Data<RigidMass<3, float> > * >( (*it).second ))
00686             {
00687               box->setColumns(2);
00688 
00689               WFloatLineEdit* editMass = new WFloatLineEdit( box, "editMass" );
00690               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editMass));
00691               editMass->setMinFloatValue( 0.0f );
00692               editMass->setMaxFloatValue( (float)INFINITY );
00693 
00694               new QLabel("Volume", box);               
00695               WFloatLineEdit* editVolume = new WFloatLineEdit( box, "editMass" );
00696               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editVolume));
00697               editVolume->setMinFloatValue( 0.0f );
00698               editVolume->setMaxFloatValue( (float)INFINITY );
00699 
00700 
00701               new QLabel("Inertia Matrix", box);        
00702               Q3Grid* grid= new Q3Grid(3,box);              
00703               WFloatLineEdit *matrix[3][3];
00704               for (int row=0;row<3;row++)
00705             {
00706               for (int column=0;column<3;column++)
00707                 {
00708 
00709                   std::ostringstream oindex;
00710                   oindex << "InertiaMatrix_" << row<<column;
00711 
00712                   matrix[row][column] = new WFloatLineEdit( grid, oindex.str().c_str() );
00713 
00714                   objectGUI.push_back(std::make_pair( (*it).second,  matrix[row][column] ));
00715                   matrix[row][column]->setMinFloatValue( (float)-INFINITY );
00716                   matrix[row][column]->setMaxFloatValue( (float)INFINITY );            
00717                 } 
00718             }
00719 
00720               new QLabel("Inertia Mass Matrix", box);       
00721               Q3Grid* massgrid= new Q3Grid(3,box);              
00722               WFloatLineEdit *massmatrix[3][3];
00723               for (int row=0;row<3;row++)
00724             {
00725               for (int column=0;column<3;column++)
00726                 {
00727 
00728                   std::ostringstream oindex;
00729                   oindex << "InertiaMassMassmatrix_" << row<<column;
00730 
00731                   massmatrix[row][column] = new WFloatLineEdit( massgrid, oindex.str().c_str() );
00732 
00733                   objectGUI.push_back(std::make_pair( (*it).second,  massmatrix[row][column] ));
00734                   massmatrix[row][column]->setMinFloatValue( (float)-INFINITY );
00735                   massmatrix[row][column]->setMaxFloatValue( (float)INFINITY );            
00736                 } 
00737             }
00738 
00739               if( Data<RigidMass<3, double> > * ff = dynamic_cast< Data<RigidMass<3, double> > * >( (*it).second )  )
00740             {
00741               RigidMass<3, double> current_mass = ff->getValue();
00742               editMass->setFloatValue(current_mass.mass);
00743               editVolume->setFloatValue(current_mass.volume);
00744 
00745               for (int row=0;row<3;row++)
00746                 {
00747                   for (int column=0;column<3;column++)
00748                 {
00749                   matrix[row][column]->setFloatValue(current_mass.inertiaMatrix[row][column]);
00750                   connect( matrix[row][column], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00751                 }
00752                 }
00753 
00754               for (int row=0;row<3;row++)
00755                 {
00756                   for (int column=0;column<3;column++)
00757                 {
00758                   massmatrix[row][column]->setFloatValue(current_mass.inertiaMassMatrix[row][column]);
00759                   connect( massmatrix[row][column], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00760                 }
00761                 }
00762             }
00763 
00764               else if( Data<RigidMass<3, float> > * ff = dynamic_cast< Data<RigidMass<3, float> > * >( (*it).second )  )
00765             {
00766               RigidMass<3, float> current_mass = ff->getValue();
00767               editMass->setFloatValue(current_mass.mass);
00768               editVolume->setFloatValue(current_mass.volume);
00769               for (int row=0;row<3;row++)
00770                 {
00771                   for (int column=0;column<3;column++)
00772                 {
00773                   matrix[row][column]->setFloatValue(current_mass.inertiaMatrix[row][column]);
00774                   connect( matrix[row][column], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00775                 }
00776                 }
00777 
00778               for (int row=0;row<3;row++)
00779                 {
00780                   for (int column=0;column<3;column++)
00781                 {
00782                   massmatrix[row][column]->setFloatValue(current_mass.inertiaMassMatrix[row][column]);
00783                   connect( massmatrix[row][column], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00784                 }
00785                 }
00786             }
00787               connect( editMass, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );             
00788               connect( editVolume, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00789 
00790             }
00791           //********************************************************************************************************//
00792           //RigidMass<2, double>,RigidMass<2, float> 
00793           else if( dynamic_cast< Data<RigidMass<2, double> > * >( (*it).second ) ||
00794                dynamic_cast< Data<RigidMass<2, float> > * >( (*it).second ))
00795             {
00796               box->setColumns(2);
00797 
00798               WFloatLineEdit* editMass = new WFloatLineEdit( box, "editMass" );
00799               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editMass));
00800               editMass->setMinFloatValue( 0.0f );
00801               editMass->setMaxFloatValue( (float)INFINITY );
00802 
00803               new QLabel("Volume", box);               
00804               WFloatLineEdit* editVolume = new WFloatLineEdit( box, "editMass" );
00805               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editVolume));
00806               editVolume->setMinFloatValue( 0.0f );
00807               editVolume->setMaxFloatValue( (float)INFINITY );
00808 
00809 
00810               new QLabel("Inertia Matrix", box);    
00811     
00812               WFloatLineEdit* editInertiaMatrix = new WFloatLineEdit( box, "editInertia" );
00813               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editInertiaMatrix));
00814               editInertiaMatrix->setMinFloatValue( 0.0f );
00815               editInertiaMatrix->setMaxFloatValue( (float)INFINITY );
00816 
00817               new QLabel("Inertia Mass Matrix", box);   
00818     
00819               WFloatLineEdit* editInertiaMassMatrix = new WFloatLineEdit( box, "editInertiaMass" );
00820               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editInertiaMassMatrix));
00821               editInertiaMassMatrix->setMinFloatValue( 0.0f );
00822               editInertiaMassMatrix->setMaxFloatValue( (float)INFINITY );
00823 
00824 
00825 
00826               if( Data<RigidMass<2, double> > * ff = dynamic_cast< Data<RigidMass<2, double> > * >( (*it).second )  )
00827             {
00828               RigidMass<2, double> current_mass = ff->getValue();
00829               editMass->setFloatValue(current_mass.mass);
00830               editVolume->setFloatValue(current_mass.volume);
00831               editInertiaMatrix->setFloatValue(current_mass.inertiaMatrix);
00832               editInertiaMassMatrix->setFloatValue(current_mass.inertiaMassMatrix);
00833             }
00834 
00835               else if( Data<RigidMass<2, float> > * ff = dynamic_cast< Data<RigidMass<2, float> > * >( (*it).second )  )
00836             {
00837               RigidMass<2, float> current_mass = ff->getValue();
00838               editMass->setFloatValue(current_mass.mass);
00839               editVolume->setFloatValue(current_mass.volume);
00840               editInertiaMatrix->setFloatValue(current_mass.inertiaMatrix);
00841               editInertiaMassMatrix->setFloatValue(current_mass.inertiaMassMatrix);
00842     
00843             }
00844               connect( editMass, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );             
00845               connect( editVolume, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );              
00846               connect( editInertiaMatrix, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00847               connect( editInertiaMassMatrix, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00848             }
00849           //********************************************************************************************************//
00850           //RigidCoord<3, double>,RigidCoord<3, float>
00851           else if( dynamic_cast< Data<RigidCoord<3, double> > * >( (*it).second ) ||
00852                dynamic_cast< Data<RigidCoord<3, float> > * >( (*it).second ))
00853             {
00854               new QLabel("Center", box);
00855             
00856               if( Data<RigidCoord<3, double> > * ff = dynamic_cast< Data<RigidCoord<3, double> > * >( (*it).second )  )
00857             {
00858               createVector(  (*it).second ,ff->getValue().getCenter(), box);
00859             }
00860               else if(Data<RigidCoord<3, float> > * ff = dynamic_cast< Data<RigidCoord<3, float> > * >( (*it).second )  )
00861             {
00862               createVector(  (*it).second ,ff->getValue().getCenter(), box);
00863             }
00864 
00865               new QLabel("Orientation", box);              
00866 
00867               if( Data<RigidCoord<3, double> > * ff = dynamic_cast< Data<RigidCoord<3, double> > * >( (*it).second )  )
00868             {
00869               createVector(  (*it).second ,ff->getValue().getOrientation(), box);
00870             }
00871               else if(Data<RigidCoord<3, float> > * ff = dynamic_cast< Data<RigidCoord<3, float> > * >( (*it).second )  )
00872             {
00873               createVector(  (*it).second ,ff->getValue().getOrientation(), box);
00874             }
00875             }
00876           //********************************************************************************************************//
00877           //RigidDeriv<3, double>,RigidDeriv<3, float>
00878           else if( dynamic_cast< Data<RigidDeriv<3, double> > * >( (*it).second ) ||
00879                dynamic_cast< Data<RigidDeriv<3, float> > * >( (*it).second ))
00880             {
00881               new QLabel("Velocity Center", box);
00882             
00883               if( Data<RigidDeriv<3, double> > * ff = dynamic_cast< Data<RigidDeriv<3, double> > * >( (*it).second )  )
00884             {
00885               createVector(  (*it).second ,ff->getValue().getVCenter(), box);
00886             }
00887               else if(Data<RigidDeriv<3, float> > * ff = dynamic_cast< Data<RigidDeriv<3, float> > * >( (*it).second )  )
00888             {
00889               createVector(  (*it).second ,ff->getValue().getVCenter(), box);
00890             }
00891 
00892               new QLabel("Velocity Orientation", box);             
00893 
00894               if( Data<RigidDeriv<3, double> > * ff = dynamic_cast< Data<RigidDeriv<3, double> > * >( (*it).second )  )
00895             {
00896               createVector(  (*it).second ,ff->getValue().getVOrientation(), box);
00897             }
00898               else if(Data<RigidDeriv<3, float> > * ff = dynamic_cast< Data<RigidDeriv<3, float> > * >( (*it).second )  )
00899             {
00900               createVector(  (*it).second ,ff->getValue().getVOrientation(), box);
00901             }
00902 
00903             }
00904           else if(Data<helper::io::Mesh::Material > *ff = dynamic_cast< Data<helper::io::Mesh::Material > * >( (*it).second ) )
00905             {
00906               helper::io::Mesh::Material material = ff->getValue(); 
00907               new QLabel("Component", box);         
00908               new QLabel("R", box);new QLabel("G", box);new QLabel("B", box);   new QLabel("A", box);
00909 
00910               QCheckBox* checkBox;
00911             
00912               //Diffuse Component
00913               checkBox = new QCheckBox(box);objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));
00914               checkBox->setChecked(material.useDiffuse);
00915               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );
00916               new QLabel("Diffuse", box);           
00917               createVector(  (*it).second ,material.diffuse, box);
00918 
00919               //Ambient Component
00920               checkBox = new QCheckBox(box);objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));          
00921               checkBox->setChecked(material.useAmbient);
00922               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );
00923               new QLabel("Ambient", box);           
00924               createVector(  (*it).second ,material.ambient, box);
00925 
00926             
00927               //Emissive Component
00928               checkBox = new QCheckBox(box);objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));          
00929               checkBox->setChecked(material.useEmissive);
00930               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );
00931               new QLabel("Emissive", box);          
00932               createVector(  (*it).second ,material.emissive, box);
00933 
00934             
00935               //Specular Component
00936               checkBox = new QCheckBox(box);objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));          
00937               checkBox->setChecked(material.useSpecular);
00938               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );
00939               new QLabel("Specular", box);          
00940               createVector(  (*it).second ,material.specular, box);
00941 
00942               //Shininess Component
00943               checkBox = new QCheckBox(box);objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) checkBox));          
00944               checkBox->setChecked(material.useShininess);
00945               connect( checkBox, SIGNAL( toggled(bool) ), this, SLOT( changeValue() ) );
00946               new QLabel("Shininess", box);         
00947               WFloatLineEdit* editShininess = new WFloatLineEdit( box, "editShininess" );
00948               objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) editShininess));
00949               editShininess->setMinFloatValue( 0.0f );
00950               editShininess->setMaxFloatValue( (float)128.0f );
00951               editShininess->setFloatValue( material.shininess);
00952               connect( editShininess, SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
00953 
00954               box->setColumns(6);
00955             }
00956           //********************************************************************************************************//
00957           //Types that needs a QTable: vector of elements           
00958           else if (createTable( (*it).second, box))
00959             {
00960               ++counterWidget; //count for two classic widgets
00961             }                    
00962           else
00963             {
00964               Q3TextEdit* textedit = new Q3TextEdit(box);
00965               //              objectGUI.push_back(std::make_pair( (*it).second,  (QObject *) textedit); 
00966 
00967               textedit->setText(QString((*it).second->getValueString().c_str()));
00968               //if empty field, we don't display it
00969 
00970               if ((*it).second->getValueString().empty() && !EMPTY_FLAG)
00971             {
00972               box->hide();          
00973               std::cerr << (*it).first << " : " << (*it).second->getValueTypeString() << " Not added because empty \n";
00974               --counterWidget; 
00975             }
00976               else          
00977             {           
00978               list_TextEdit.push_back(std::make_pair(textedit, (*it).second));  
00979               ++counterWidget; //count for two classic widgets
00980               connect( textedit, SIGNAL( textChanged() ), this, SLOT( changeValue() ) );
00981             }
00982             }
00983         }
00984         ++i;
00985         if (box != NULL) 
00986           {         
00987                     if (currentTab == currentTab_save && emptyTab && counterWidget/WIDGET_BY_TAB == counterTab) 
00988               {                                            
00989             dialogTab->addTab(currentTab, QString("Properties ") + QString::number(counterWidget/WIDGET_BY_TAB));
00990             ++counterTab;
00991             emptyTab = false;
00992               }
00993 
00994             dataIndexTab.insert(std::make_pair((*it).second, dialogTab->count()-1));    
00995                     ++counterWidget;
00996             currentTabLayout->addWidget( box );
00997           }
00998               }
00999 
01000             if (tabPropertiesLayout!= NULL) tabPropertiesLayout->addStretch();
01001             if (tabVisualization != NULL)   
01002           {
01003         dialogTab->addTab(tabVisualization, QString("Visualization"));
01004           }
01005             for (unsigned int indexTab = 0; indexTab<counterTab;indexTab++)
01006           {
01007         if (counterTab == 1)
01008           dialogTab->setTabLabel(dialogTab->page(indexTab), 
01009                      QString("Properties"));
01010         else
01011           dialogTab->setTabLabel(dialogTab->page(indexTab), 
01012                      QString("Properties ") + QString::number(indexTab+1) + QString("/") + QString::number(counterTab));
01013           }
01014 
01015         if (Node* node = dynamic_cast< Node* >(node_clicked))
01016           {
01017         if (node->mass!= NULL || node->forceField.size()!=0 ) 
01018         {
01019           createGraphMass(dialogTab);
01020         }
01021           }
01022 
01023         // Info tab
01024         {
01025         emptyTab = false;
01026         QWidget* tab = new QWidget();
01027         QVBoxLayout* tabLayout = new QVBoxLayout( tab, 0, 1, QString("tabInfoLayout"));
01028 
01029         dialogTab->addTab(tab, QString("Infos"));
01030         ++counterTab;
01031         //Instance
01032         {
01033             Q3GroupBox *box = new Q3GroupBox(tab, QString("Instance"));
01034             box->setColumns(2);
01035             box->setTitle(QString("Instance"));
01036             new QLabel(QString("Name"), box);
01037             new QLabel(QString(node_clicked->getName().c_str()), box);
01038             new QLabel(QString("Class"), box);
01039             new QLabel(QString(node_clicked->getClassName().c_str()), box);
01040             std::string namespacename = node_clicked->decodeNamespaceName(typeid(*node_clicked));
01041             if (!namespacename.empty())
01042             {
01043             new QLabel(QString("Namespace"), box);
01044             new QLabel(QString(namespacename.c_str()), box);
01045             }
01046             if (!node_clicked->getTemplateName().empty())
01047             {
01048             new QLabel(QString("Template"), box);
01049             new QLabel(QString(node_clicked->getTemplateName().c_str()), box);
01050             }
01051             
01052             tabLayout->addWidget( box );
01053         }
01054 
01055         //Class description
01056         core::ObjectFactory::ClassEntry* entry = core::ObjectFactory::getInstance()->getEntry(node_clicked->getClassName());
01057         if (entry != NULL && ! entry->creatorList.empty())
01058         {
01059             Q3GroupBox *box = new Q3GroupBox(tab, QString("Class"));
01060             box->setColumns(2);
01061             box->setTitle(QString("Class"));
01062             if (!entry->description.empty() && entry->description != std::string("TODO"))
01063             {
01064             new QLabel(QString("Description"), box);
01065             new QLabel(QString(entry->description.c_str()), box);
01066             }
01067             if (!entry->authors.empty() && entry->authors != std::string("TODO"))
01068             {
01069             new QLabel(QString("Authors"), box);
01070             new QLabel(QString(entry->authors.c_str()), box);
01071             }
01072             if (!entry->license.empty() && entry->license != std::string("TODO"))
01073             {
01074             new QLabel(QString("License"), box);
01075             new QLabel(QString(entry->license.c_str()), box);
01076             }
01077             tabLayout->addWidget( box );
01078         }
01079 
01080         //Log of initialization
01081         core::objectmodel::BaseObject *obj = dynamic_cast< core::objectmodel::BaseObject* >(node_clicked);
01082         if (obj && obj->getLogWarning().size() != 0)
01083           {
01084             const sofa::helper::vector< std::string > &log = obj->getLogWarning();
01085             Q3GroupBox *box = new Q3GroupBox(tab, QString("Log"));
01086             box->setColumns(1);
01087             box->setTitle(QString("Log"));
01088             for (unsigned int idLog=0;idLog<log.size();++idLog)
01089               {
01090             new QLabel(QString(log[idLog].c_str()), box);
01091               }
01092             tabLayout->addWidget( box );
01093           }
01094         tabLayout->addStretch();
01095         }
01096 
01097         //Adding buttons at the bottom of the dialog
01098         QHBoxLayout *lineLayout = new QHBoxLayout( 0, 0, 6, "Button Layout");
01099 
01100         buttonUpdate = new QPushButton( this, "buttonUpdate" );
01101         lineLayout->addWidget(buttonUpdate);
01102         buttonUpdate->setText("&Update");
01103         buttonUpdate->setEnabled(false);
01104 
01105         QSpacerItem *Horizontal_Spacing = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
01106         lineLayout->addItem( Horizontal_Spacing );
01107 
01108         QPushButton *buttonOk = new QPushButton( this, "buttonOk" );
01109         lineLayout->addWidget(buttonOk);
01110         buttonOk->setText( tr( "&OK" ) );
01111 
01112         QPushButton *buttonCancel = new QPushButton( this, "buttonCancel" );
01113         lineLayout->addWidget(buttonCancel);
01114         buttonCancel->setText( tr( "&Cancel" ) );
01115 
01116         generalLayout->addLayout( lineLayout );
01117 
01118 
01119 
01120         //Signals and slots connections
01121         connect( buttonUpdate,   SIGNAL( clicked() ), this, SLOT( updateValues() ) );       
01122         connect( buttonOk,       SIGNAL( clicked() ), this, SLOT( accept() ) );
01123         connect( buttonCancel,   SIGNAL( clicked() ), this, SLOT( reject() ) );
01124 
01125 
01126 
01127         resize( QSize(553, 130).expandedTo(minimumSizeHint()) );
01128       }
01129 
01130 
01131       }
01132 
01133 
01134       //*******************************************************************************************************************
01135       void ModifyObject::changeValue()
01136       {
01137     setUpdates.insert(getData(sender()));
01138     if (buttonUpdate == NULL) return;
01139     buttonUpdate->setEnabled(true);
01140       }
01141       void ModifyObject::changeVisualValue()
01142       {
01143     setUpdates.insert(getData(sender()));
01144     if (buttonUpdate == NULL) return;
01145     buttonUpdate->setEnabled(true);
01146     visualContentModified = true;
01147       }
01148       //*******************************************************************************************************************
01149       void ModifyObject::updateValues()
01150       {
01151     if (buttonUpdate == NULL // || !buttonUpdate->isEnabled()
01152         ) return;
01153 
01154 
01155     saveTextEdit();
01156     saveTables();
01157 
01158     //Make the update of all the values
01159     if (node)
01160       {
01161 
01162         //If the current element is a node of the graph, we first apply the transformations
01163         if (Node* current_node = dynamic_cast< Node *>(node))
01164           {
01165         if (!(transformation[0]->getFloatValue() == 0 && 
01166               transformation[1]->getFloatValue() == 0 && 
01167               transformation[2]->getFloatValue() == 0 &&
01168               transformation[3]->getFloatValue()    == 0 && 
01169               transformation[4]->getFloatValue()    == 0 && 
01170               transformation[5]->getFloatValue()    == 0 && 
01171               transformation[6]->getFloatValue() == 1 ))
01172           {
01173             
01174             sofa::simulation::TransformationVisitor transform;
01175             transform.setTranslation(transformation[0]->getFloatValue(),transformation[1]->getFloatValue(),transformation[2]->getFloatValue());
01176             transform.setRotation(transformation[3]->getFloatValue(),transformation[4]->getFloatValue(),transformation[5]->getFloatValue());
01177             transform.setScale(transformation[6]->getFloatValue());
01178             transform.execute(current_node);
01179 
01180             transformation[0]->setFloatValue(0);
01181             transformation[1]->setFloatValue(0);
01182             transformation[2]->setFloatValue(0);
01183             
01184             transformation[3]->setFloatValue(0);
01185             transformation[4]->setFloatValue(0);
01186             transformation[5]->setFloatValue(0);
01187             
01188             transformation[6]->setFloatValue(1);
01189 
01190           }
01191           }
01192 
01193         for (unsigned int index_object=0;index_object < objectGUI.size();++index_object)
01194           {
01195         //Special Treatment for visual flags
01196         if( visualContentModified && objectGUI[index_object].second == (QObject*) displayFlag)
01197           {
01198             for (unsigned int i=0;i<10;++i)
01199               {         
01200             Data<int> * ff = dynamic_cast< Data<int> * >( objectGUI[index_object].first );
01201             ff->setValue(displayFlag->getFlag(i));
01202             index_object++;
01203               }
01204             index_object--;     
01205           }
01206         
01207         if (setUpdates.find(objectGUI[index_object].first ) == setUpdates.end()) continue;
01208         //*******************************************************************************************************************
01209         if( Data<int> * ff = dynamic_cast< Data<int> * >( objectGUI[index_object].first )  )
01210           {         
01211 
01212             if (dynamic_cast< QSpinBox *> ( objectGUI[index_object].second ))
01213               {
01214             
01215             QSpinBox* spinBox = dynamic_cast< QSpinBox *> ( objectGUI[index_object].second ); 
01216             ff->setValue(spinBox->value());
01217               }
01218 
01219           }
01220         //*******************************************************************************************************************
01221         else if( Data<unsigned int> * ff = dynamic_cast< Data<unsigned int> * >( objectGUI[index_object].first )  )
01222           {
01223 
01224             QSpinBox* spinBox = dynamic_cast< QSpinBox *> ( objectGUI[index_object].second ); 
01225 
01226             ff->setValue(spinBox->value());
01227           }
01228         //*******************************************************************************************************************
01229         else if( dynamic_cast< Data<float> * >( objectGUI[index_object].first ) || 
01230              dynamic_cast< Data<double> * >( objectGUI[index_object].first ))
01231           {     
01232             WFloatLineEdit* editSFFloat = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second ); 
01233 
01234 
01235             if( Data<float> * ff = dynamic_cast< Data<float> * >( objectGUI[index_object].first )  )
01236               {
01237             ff->setValue(editSFFloat->getFloatValue());
01238               }
01239             else if(Data<double> * ff = dynamic_cast< Data<double> * >( objectGUI[index_object].first )  )
01240               {
01241             ff->setValue((double) editSFFloat->getFloatValue());
01242               }
01243 
01244           }
01245         //*******************************************************************************************************************
01246         else if( Data<bool> * ff = dynamic_cast< Data<bool> * >( objectGUI[index_object].first ))
01247           {
01248             // the bool line edit
01249             QCheckBox* checkBox = dynamic_cast< QCheckBox *> ( objectGUI[index_object].second );        
01250             ff->setValue(checkBox->isOn());
01251           }
01252         //*******************************************************************************************************************
01253         else if( Data<std::string> * ff = dynamic_cast< Data<std::string> * >( objectGUI[index_object].first )  )
01254           {
01255 
01256             QLineEdit* lineEdit = dynamic_cast< QLineEdit *> ( objectGUI[index_object].second ); 
01257 
01258             ff->setValue(lineEdit->text().ascii());
01259 
01260 
01261             if( !dynamic_cast< Node *>(node) && !strcmp(ff->help,"object name") )
01262               {           
01263             std::string name=item->text(0).ascii();
01264             std::string::size_type pos = name.find(' ');
01265             if (pos != std::string::npos)
01266               name.resize(pos);
01267             name += "  ";
01268               
01269             name+=lineEdit->text().ascii();
01270             item->setText(0,name.c_str());
01271               }
01272             else if (dynamic_cast< Node *>(node))             
01273               item->setText(0,lineEdit->text().ascii());              
01274               
01275           }   
01276         //*******************************************************************************************************************
01277         else if( dynamic_cast< Data<Vec6f> * >( objectGUI[index_object].first )         ||
01278              dynamic_cast< Data<Vec6d> * >( objectGUI[index_object].first )         ||
01279              dynamic_cast< Data<Vec<6,int> > * >( objectGUI[index_object].first )   || 
01280              dynamic_cast< Data<Vec<6,unsigned int> > * >( objectGUI[index_object].first )   )
01281           {
01282             if( Data<Vec6f> * ff = dynamic_cast< Data<Vec6f> * >( objectGUI[index_object].first )  )
01283               {
01284             storeVector(index_object, ff);
01285               }
01286             else if(Data<Vec6d> * ff = dynamic_cast< Data<Vec6d> * >( objectGUI[index_object].first )  )
01287               {
01288             storeVector(index_object, ff);
01289               }
01290             else if( Data<Vec<6,int> > * ff = dynamic_cast< Data<Vec<6,int> > * >( objectGUI[index_object].first )  )
01291               {
01292             storeVector(index_object, ff);
01293               }
01294             else if(Data<Vec<6, unsigned int> > * ff = dynamic_cast< Data<Vec<6, unsigned int> > * >( objectGUI[index_object].first )  )
01295               {
01296             storeVector(index_object, ff);
01297               }
01298           }
01299         //*******************************************************************************************************************
01300         else if(  dynamic_cast< Data<Vec4f> * >( objectGUI[index_object].first )           ||
01301               dynamic_cast< Data<Vec4d> * >( objectGUI[index_object].first )           ||
01302               dynamic_cast< Data<Vec<4,int> > * >( objectGUI[index_object].first )     || 
01303               dynamic_cast< Data<Vec<4,unsigned int> > * >( objectGUI[index_object].first )  )
01304           {
01305 
01306             if( Data<Vec4f> * ff = dynamic_cast< Data<Vec4f> * >( objectGUI[index_object].first )  )
01307               {
01308             storeVector(index_object, ff);
01309               }
01310             else if(Data<Vec4d> * ff = dynamic_cast< Data<Vec4d> * >( objectGUI[index_object].first )  )
01311               {
01312             storeVector(index_object, ff);
01313               }
01314             else if( Data<Vec<4,int> > * ff = dynamic_cast< Data<Vec<4,int> > * >( objectGUI[index_object].first )  )
01315               {
01316             storeVector(index_object, ff);
01317               }
01318             else if(Data<Vec<4, unsigned int> > * ff = dynamic_cast< Data<Vec<4, unsigned int> > * >( objectGUI[index_object].first )  )
01319               {
01320             storeVector(index_object, ff);
01321               }
01322 
01323           }
01324         //*******************************************************************************************************************
01325         else if( dynamic_cast< Data<Vec3f> * >( objectGUI[index_object].first )         ||
01326              dynamic_cast< Data<Vec3d> * >( objectGUI[index_object].first )         ||
01327              dynamic_cast< Data<Vec<3,int> > * >( objectGUI[index_object].first )   || 
01328              dynamic_cast< Data<Vec<3,unsigned int> > * >( objectGUI[index_object].first )  )
01329           {
01330 
01331             if( Data<Vec3f> * ff = dynamic_cast< Data<Vec3f> * >( objectGUI[index_object].first )  )
01332               {
01333             storeVector(index_object, ff);
01334               }
01335             else if(Data<Vec3d> * ff = dynamic_cast< Data<Vec3d> * >( objectGUI[index_object].first )  )
01336               {
01337             storeVector(index_object, ff);
01338               }
01339             else if( Data<Vec<3,int> > * ff = dynamic_cast< Data<Vec<3,int> > * >( objectGUI[index_object].first )  )
01340               {
01341             storeVector(index_object, ff);
01342               }
01343             else if(Data<Vec<3, unsigned int> > * ff = dynamic_cast< Data<Vec<3, unsigned int> > * >( objectGUI[index_object].first )  )
01344               {
01345             storeVector(index_object, ff);
01346               }
01347 
01348 
01349           }
01350         //*******************************************************************************************************************
01351         else if( dynamic_cast< Data<Vec2f> * >( objectGUI[index_object].first )          ||
01352              dynamic_cast< Data<Vec2d> * >( objectGUI[index_object].first )          || 
01353              dynamic_cast< Data<Vec<2,int> > * >( objectGUI[index_object].first )    || 
01354              dynamic_cast< Data<Vec<2,unsigned int> > * >( objectGUI[index_object].first )  )
01355           {
01356 
01357 
01358             if( Data<Vec2f> * ff = dynamic_cast< Data<Vec2f> * >( objectGUI[index_object].first )  )
01359               {
01360             storeVector(index_object, ff);
01361               }
01362             else if(Data<Vec2d> * ff = dynamic_cast< Data<Vec2d> * >( objectGUI[index_object].first )  )
01363               {
01364             storeVector(index_object, ff);
01365               }
01366             else if( Data<Vec<2,int> > * ff = dynamic_cast< Data<Vec<2,int> > * >( objectGUI[index_object].first )  )
01367               {
01368             storeVector(index_object, ff);
01369               }
01370             else if(Data<Vec<2, unsigned int> > * ff = dynamic_cast< Data<Vec<2, unsigned int> > * >( objectGUI[index_object].first )  )
01371               {
01372             storeVector(index_object, ff);
01373               }
01374 
01375           }
01376         //*******************************************************************************************************************
01377         else if( dynamic_cast< Data<Vec1f> * >( objectGUI[index_object].first )         ||
01378              dynamic_cast< Data<Vec1d> * >( objectGUI[index_object].first )         ||
01379              dynamic_cast< Data<Vec<1,int> > * >( objectGUI[index_object].first )   || 
01380              dynamic_cast< Data<Vec<1,unsigned int> > * >( objectGUI[index_object].first )  )
01381           {
01382 
01383 
01384             if( Data<Vec1f> * ff = dynamic_cast< Data<Vec1f> * >( objectGUI[index_object].first )  )
01385               {
01386             storeVector(index_object, ff);
01387               }
01388             else if(Data<Vec1d> * ff = dynamic_cast< Data<Vec1d> * >( objectGUI[index_object].first )  )
01389               {
01390             storeVector(index_object, ff);
01391               }
01392             else if( Data<Vec<1,int> > * ff = dynamic_cast< Data<Vec<1,int> > * >( objectGUI[index_object].first )  )
01393               {
01394             storeVector(index_object, ff);
01395               }
01396             else if(Data<Vec<1, unsigned int> > * ff = dynamic_cast< Data<Vec<1, unsigned int> > * >( objectGUI[index_object].first )  )
01397               {
01398             storeVector(index_object, ff);
01399               }
01400 
01401           }
01402         else if( Data<RigidCoord<3,double> > * ff = dynamic_cast< Data<RigidCoord<3,double> > * >( objectGUI[index_object].first )  )
01403           {
01404             RigidCoord<3,double> v;
01405             storeVector(index_object, &v.getCenter());
01406             storeVector(index_object, &v.getOrientation());
01407             ff->setValue(v);
01408           }
01409         else if( Data<RigidDeriv<3,double> > * ff = dynamic_cast< Data<RigidDeriv<3,double> > * >( objectGUI[index_object].first )  )
01410           {
01411             RigidDeriv<3,double> v;
01412             storeVector(index_object, &v.getVCenter());
01413             storeVector(index_object, &v.getVOrientation());
01414             ff->setValue(v);
01415           }
01416         //*******************************************************************************************************************
01417         else if( Data<RigidMass<3, double> > * ff = dynamic_cast< Data<RigidMass<3, double> > * >( objectGUI[index_object].first )  )
01418           {
01419             RigidMass<3, double> current_mass = ff->getValue();
01420 
01421             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01422             current_mass.mass = (double) mass->getFloatValue();
01423             index_object++;
01424             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01425             current_mass.volume = (double) volume->getFloatValue();
01426             index_object++;
01427             for (int row=0;row<3;row++)
01428               {
01429             for (int column=0;column<3;column++)
01430               {
01431                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01432                 current_mass.inertiaMatrix[row][column] = (double) matrix_element->getFloatValue();
01433                 index_object++;
01434               }             
01435               }
01436             for (int row=0;row<3;row++)
01437               {
01438             for (int column=0;column<3;column++)
01439               {
01440                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01441                 current_mass.inertiaMassMatrix[row][column] = (double) matrix_element->getFloatValue();
01442                 index_object++;
01443               }             
01444               }
01445             index_object--;
01446             ff->setValue(current_mass);
01447           }
01448         //*******************************************************************************************************************
01449         else if( Data<RigidMass<3, float> > * ff = dynamic_cast< Data<RigidMass<3, float> > * >( objectGUI[index_object].first )  )
01450           {
01451             RigidMass<3, float> current_mass = ff->getValue();      
01452 
01453             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01454             current_mass.mass =  mass->getFloatValue();
01455             index_object++;
01456             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01457             current_mass.volume =  volume->getFloatValue();
01458             index_object++;
01459             for (int row=0;row<3;row++)
01460               {
01461             for (int column=0;column<3;column++)
01462               {
01463                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01464                 current_mass.inertiaMatrix[row][column] = (double) matrix_element->getFloatValue();
01465                 index_object++;
01466               }             
01467               }
01468             for (int row=0;row<3;row++)
01469               {
01470             for (int column=0;column<3;column++)
01471               {
01472                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01473                 current_mass.inertiaMassMatrix[row][column] = (double) matrix_element->getFloatValue();
01474                 index_object++;
01475               }             
01476               }
01477             index_object--;
01478             ff->setValue(current_mass);
01479           }
01480         //*******************************************************************************************************************
01481         else if( Data<RigidMass<2, double> > * ff = dynamic_cast< Data<RigidMass<2, double> > * >( objectGUI[index_object].first )  )
01482           {
01483             RigidMass<2, double> current_mass = ff->getValue();
01484 
01485             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01486             current_mass.mass = (double) mass->getFloatValue();
01487             index_object++;
01488             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01489             current_mass.volume = (double) volume->getFloatValue();
01490             index_object++;
01491             WFloatLineEdit* inertiaMatrix = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01492             current_mass.inertiaMatrix = (double) inertiaMatrix->getFloatValue();
01493 
01494 
01495             ff->setValue(current_mass);
01496           }
01497         //*******************************************************************************************************************
01498         else if( Data<RigidMass<2, float> > * ff = dynamic_cast< Data<RigidMass<2, float> > * >( objectGUI[index_object].first )  )
01499           {
01500             RigidMass<2, float> current_mass = ff->getValue();      
01501 
01502             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01503             current_mass.mass =  mass->getFloatValue();
01504             index_object++;
01505             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01506             current_mass.volume =  volume->getFloatValue();
01507             index_object++;
01508             WFloatLineEdit* inertiaMatrix = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01509             current_mass.inertiaMatrix = (double) inertiaMatrix->getFloatValue();
01510             index_object++;
01511             WFloatLineEdit* inertiaMassMatrix = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01512             current_mass.inertiaMassMatrix = (double) inertiaMassMatrix->getFloatValue();
01513             index_object++;
01514 
01515             ff->setValue(current_mass);
01516           }
01517         else if (Data<helper::io::Mesh::Material > *ff = dynamic_cast< Data<helper::io::Mesh::Material > * >( objectGUI[index_object].first ))
01518           {
01519             helper::io::Mesh::Material M;  QCheckBox* checkBox;    WFloatLineEdit* value;
01520 
01521             //Diffuse
01522             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01523             M.useDiffuse = checkBox->isOn();
01524             index_object++;
01525             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     M.diffuse[i] = value->getFloatValue(); index_object++;}
01526             //Ambient
01527             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01528             M.useAmbient = checkBox->isOn();
01529             index_object++;
01530             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     M.ambient[i] = value->getFloatValue();index_object++;}
01531             //Emissive
01532             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01533             M.useEmissive = checkBox->isOn();
01534             index_object++;
01535             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );   M.emissive[i] = value->getFloatValue();index_object++;}
01536             //Specular
01537             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01538             M.useSpecular = checkBox->isOn();
01539             index_object++;
01540             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     M.specular[i] = value->getFloatValue();index_object++;}
01541             //Shininess
01542             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01543             M.useShininess = checkBox->isOn();
01544             index_object++;
01545             value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01546             M.shininess = value->getFloatValue();
01547 
01548             ff->setValue(M);
01549           }
01550         //**********************************************************************
01551         //support for Dataptr
01552         //*******************************************************************************************************************
01553         else if( DataPtr<int> * ff = dynamic_cast< DataPtr<int> * >( objectGUI[index_object].first )  )
01554           {     
01555             if (dynamic_cast< QSpinBox *> ( objectGUI[index_object].second ))
01556               {
01557             
01558             QSpinBox* spinBox = dynamic_cast< QSpinBox *> ( objectGUI[index_object].second ); 
01559             ff->setValue(spinBox->value());
01560               }
01561             else 
01562               {
01563             QCheckBox* checkBox = dynamic_cast< QCheckBox *> ( objectGUI[index_object].second );        
01564             ff->setValue(checkBox->isOn());
01565               }
01566 
01567           }
01568         //*******************************************************************************************************************
01569         else if( DataPtr<unsigned int> * ff = dynamic_cast< DataPtr<unsigned int> * >( objectGUI[index_object].first )  )
01570           {
01571 
01572             QSpinBox* spinBox = dynamic_cast< QSpinBox *> ( objectGUI[index_object].second ); 
01573 
01574             ff->setValue(spinBox->value());
01575           }
01576         //*******************************************************************************************************************
01577         else if( dynamic_cast< DataPtr<float> * >( objectGUI[index_object].first ) || 
01578              dynamic_cast< DataPtr<double> * >( objectGUI[index_object].first ))
01579           {     
01580             WFloatLineEdit* editSFFloat = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second ); 
01581 
01582 
01583             if( DataPtr<float> * ff = dynamic_cast< DataPtr<float> * >( objectGUI[index_object].first )  )
01584               {
01585             ff->setValue(editSFFloat->getFloatValue());
01586               }
01587             else if(DataPtr<double> * ff = dynamic_cast< DataPtr<double> * >( objectGUI[index_object].first )  )
01588               {
01589             ff->setValue((double) editSFFloat->getFloatValue());
01590               }
01591 
01592           }
01593         //*******************************************************************************************************************
01594         else if( DataPtr<bool> * ff = dynamic_cast< DataPtr<bool> * >( objectGUI[index_object].first ))
01595           {
01596             // the bool line edit
01597             QCheckBox* checkBox = dynamic_cast< QCheckBox *> ( objectGUI[index_object].second );        
01598             ff->setValue(checkBox->isOn());
01599           }
01600         //*******************************************************************************************************************
01601         else if( DataPtr<std::string> * ff = dynamic_cast< DataPtr<std::string> * >( objectGUI[index_object].first )  )
01602           {
01603 
01604             QLineEdit* lineEdit = dynamic_cast< QLineEdit *> ( objectGUI[index_object].second ); 
01605 
01606             ff->setValue(lineEdit->text().ascii());
01607 
01608 
01609             if( !dynamic_cast< Node *>(node) && !strcmp(ff->help,"object name") )
01610               {           
01611             std::string name=item->text(0).ascii();
01612             std::string::size_type pos = name.find(' ');
01613             if (pos != std::string::npos)
01614               name.resize(pos);
01615             name += "  ";
01616               
01617             name+=lineEdit->text().ascii();
01618             item->setText(0,name.c_str());
01619               }
01620             else if (dynamic_cast< Node *>(node))             
01621               item->setText(0,lineEdit->text().ascii());              
01622               
01623           }
01624         //*******************************************************************************************************************
01625         else if( dynamic_cast< DataPtr<Vec6f> * >( objectGUI[index_object].first )         ||
01626              dynamic_cast< DataPtr<Vec6d> * >( objectGUI[index_object].first )         ||
01627              dynamic_cast< DataPtr<Vec<6,int> > * >( objectGUI[index_object].first )   || 
01628              dynamic_cast< DataPtr<Vec<6,unsigned int> > * >( objectGUI[index_object].first )   )
01629           {
01630             if( DataPtr<Vec6f> * ff = dynamic_cast< DataPtr<Vec6f> * >( objectGUI[index_object].first )  )
01631               {
01632             storeVector(index_object, ff);
01633               }
01634             else if(DataPtr<Vec6d> * ff = dynamic_cast< DataPtr<Vec6d> * >( objectGUI[index_object].first )  )
01635               {
01636             storeVector(index_object, ff);
01637               }
01638             else if( DataPtr<Vec<6,int> > * ff = dynamic_cast< DataPtr<Vec<6,int> > * >( objectGUI[index_object].first )  )
01639               {
01640             storeVector(index_object, ff);
01641               }
01642             else if(DataPtr<Vec<6, unsigned int> > * ff = dynamic_cast< DataPtr<Vec<6, unsigned int> > * >( objectGUI[index_object].first )  )
01643               {
01644             storeVector(index_object, ff);
01645               }
01646 
01647 
01648           }
01649         //*******************************************************************************************************************
01650         else if(  dynamic_cast< DataPtr<Vec4f> * >( objectGUI[index_object].first )           ||
01651               dynamic_cast< DataPtr<Vec4d> * >( objectGUI[index_object].first )           ||
01652               dynamic_cast< DataPtr<Vec<4,int> > * >( objectGUI[index_object].first )     || 
01653               dynamic_cast< DataPtr<Vec<4,unsigned int> > * >( objectGUI[index_object].first )  )
01654           {
01655 
01656             if( DataPtr<Vec4f> * ff = dynamic_cast< DataPtr<Vec4f> * >( objectGUI[index_object].first )  )
01657               {
01658             storeVector(index_object, ff);
01659               }
01660             else if(DataPtr<Vec4d> * ff = dynamic_cast< DataPtr<Vec4d> * >( objectGUI[index_object].first )  )
01661               {
01662             storeVector(index_object, ff);
01663               }
01664             else if( DataPtr<Vec<4,int> > * ff = dynamic_cast< DataPtr<Vec<4,int> > * >( objectGUI[index_object].first )  )
01665               {
01666             storeVector(index_object, ff);
01667               }
01668             else if(DataPtr<Vec<4, unsigned int> > * ff = dynamic_cast< DataPtr<Vec<4, unsigned int> > * >( objectGUI[index_object].first )  )
01669               {
01670             storeVector(index_object, ff);
01671               }
01672 
01673           }
01674         //*******************************************************************************************************************
01675         else if( dynamic_cast< DataPtr<Vec3f> * >( objectGUI[index_object].first )         ||
01676              dynamic_cast< DataPtr<Vec3d> * >( objectGUI[index_object].first )         ||
01677              dynamic_cast< DataPtr<Vec<3,int> > * >( objectGUI[index_object].first )   || 
01678              dynamic_cast< DataPtr<Vec<3,unsigned int> > * >( objectGUI[index_object].first )  )
01679           {
01680 
01681             if( DataPtr<Vec3f> * ff = dynamic_cast< DataPtr<Vec3f> * >( objectGUI[index_object].first )  )
01682               {
01683             storeVector(index_object, ff);
01684               }
01685             else if(DataPtr<Vec3d> * ff = dynamic_cast< DataPtr<Vec3d> * >( objectGUI[index_object].first )  )
01686               {
01687             storeVector(index_object, ff);
01688               }
01689             else if( DataPtr<Vec<3,int> > * ff = dynamic_cast< DataPtr<Vec<3,int> > * >( objectGUI[index_object].first )  )
01690               {
01691             storeVector(index_object, ff);
01692               }
01693             else if(DataPtr<Vec<3, unsigned int> > * ff = dynamic_cast< DataPtr<Vec<3, unsigned int> > * >( objectGUI[index_object].first )  )
01694               {
01695             storeVector(index_object, ff);
01696               }
01697 
01698 
01699           }
01700         //*******************************************************************************************************************
01701         else if( dynamic_cast< DataPtr<Vec2f> * >( objectGUI[index_object].first )          ||
01702              dynamic_cast< DataPtr<Vec2d> * >( objectGUI[index_object].first )          || 
01703              dynamic_cast< DataPtr<Vec<2,int> > * >( objectGUI[index_object].first )    || 
01704              dynamic_cast< DataPtr<Vec<2,unsigned int> > * >( objectGUI[index_object].first )  )
01705           {
01706 
01707 
01708             if( DataPtr<Vec2f> * ff = dynamic_cast< DataPtr<Vec2f> * >( objectGUI[index_object].first )  )
01709               {
01710             storeVector(index_object, ff);
01711               }
01712             else if(DataPtr<Vec2d> * ff = dynamic_cast< DataPtr<Vec2d> * >( objectGUI[index_object].first )  )
01713               {
01714             storeVector(index_object, ff);
01715               }
01716             else if( DataPtr<Vec<2,int> > * ff = dynamic_cast< DataPtr<Vec<2,int> > * >( objectGUI[index_object].first )  )
01717               {
01718             storeVector(index_object, ff);
01719               }
01720             else if(DataPtr<Vec<2, unsigned int> > * ff = dynamic_cast< DataPtr<Vec<2, unsigned int> > * >( objectGUI[index_object].first )  )
01721               {
01722             storeVector(index_object, ff);
01723               }
01724 
01725           }
01726         //*******************************************************************************************************************
01727         else if( dynamic_cast< DataPtr<Vec1f> * >( objectGUI[index_object].first )         ||
01728              dynamic_cast< DataPtr<Vec1d> * >( objectGUI[index_object].first )         ||
01729              dynamic_cast< DataPtr<Vec<1,int> > * >( objectGUI[index_object].first )   || 
01730              dynamic_cast< DataPtr<Vec<1,unsigned int> > * >( objectGUI[index_object].first )  )
01731           {
01732 
01733 
01734             if( DataPtr<Vec1f> * ff = dynamic_cast< DataPtr<Vec1f> * >( objectGUI[index_object].first )  )
01735               {
01736             storeVector(index_object, ff);
01737               }
01738             else if(DataPtr<Vec1d> * ff = dynamic_cast< DataPtr<Vec1d> * >( objectGUI[index_object].first )  )
01739               {
01740             storeVector(index_object, ff);
01741               }
01742             else if( DataPtr<Vec<1,int> > * ff = dynamic_cast< DataPtr<Vec<1,int> > * >( objectGUI[index_object].first )  )
01743               {
01744             storeVector(index_object, ff);
01745               }
01746             else if(DataPtr<Vec<1, unsigned int> > * ff = dynamic_cast< DataPtr<Vec<1, unsigned int> > * >( objectGUI[index_object].first )  )
01747               {
01748             storeVector(index_object, ff);
01749               }
01750 
01751           }
01752         else if( DataPtr<RigidCoord<3,double> > * ff = dynamic_cast< DataPtr<RigidCoord<3,double> > * >( objectGUI[index_object].first )  )
01753           {
01754             RigidCoord<3,double> v;
01755             storeVector(index_object, &v.getCenter());
01756             storeVector(index_object, &v.getOrientation());
01757             ff->setValue(v);
01758           }
01759         else if( DataPtr<RigidDeriv<3,double> > * ff = dynamic_cast< DataPtr<RigidDeriv<3,double> > * >( objectGUI[index_object].first )  )
01760           {
01761             RigidDeriv<3,double> v;
01762             storeVector(index_object, &v.getVCenter());
01763             storeVector(index_object, &v.getVOrientation());
01764             ff->setValue(v);
01765           }
01766         //*******************************************************************************************************************
01767         else if( DataPtr<RigidMass<3, double> > * ff = dynamic_cast< DataPtr<RigidMass<3, double> > * >( objectGUI[index_object].first )  )
01768           {
01769             RigidMass<3, double> current_mass = ff->getValue();
01770 
01771             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01772             current_mass.mass = (double) mass->getFloatValue();
01773             index_object++;
01774             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01775             current_mass.volume = (double) volume->getFloatValue();
01776             index_object++;
01777             for (int row=0;row<3;row++)
01778               {
01779             for (int column=0;column<3;column++)
01780               {
01781                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01782                 current_mass.inertiaMatrix[row][column] = (double) matrix_element->getFloatValue();
01783                 index_object++;
01784               }             
01785               }
01786             for (int row=0;row<3;row++)
01787               {
01788             for (int column=0;column<3;column++)
01789               {
01790                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01791                 current_mass.inertiaMassMatrix[row][column] = (double) matrix_element->getFloatValue();
01792                 index_object++;
01793               }             
01794               }
01795             index_object--;
01796             ff->setValue(current_mass);
01797           }
01798         //*******************************************************************************************************************
01799         else if( DataPtr<RigidMass<3, float> > * ff = dynamic_cast< DataPtr<RigidMass<3, float> > * >( objectGUI[index_object].first )  )
01800           {
01801             RigidMass<3, float> current_mass = ff->getValue();      
01802 
01803             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01804             current_mass.mass =  mass->getFloatValue();
01805             index_object++;
01806             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01807             current_mass.volume =  volume->getFloatValue();
01808             index_object++;
01809             for (int row=0;row<3;row++)
01810               {
01811             for (int column=0;column<3;column++)
01812               {
01813                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01814                 current_mass.inertiaMatrix[row][column] = (double) matrix_element->getFloatValue();
01815                 index_object++;
01816               }             
01817               }
01818             for (int row=0;row<3;row++)
01819               {
01820             for (int column=0;column<3;column++)
01821               {
01822                 WFloatLineEdit* matrix_element = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01823                 current_mass.inertiaMassMatrix[row][column] = (double) matrix_element->getFloatValue();
01824                 index_object++;
01825               }             
01826               }
01827             index_object--;
01828             ff->setValue(current_mass);
01829           }
01830         //*******************************************************************************************************************
01831         else if( DataPtr<RigidMass<2, double> > * ff = dynamic_cast< DataPtr<RigidMass<2, double> > * >( objectGUI[index_object].first )  )
01832           {
01833             RigidMass<2, double> current_mass = ff->getValue();
01834 
01835             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01836             current_mass.mass = (double) mass->getFloatValue();
01837             index_object++;
01838             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01839             current_mass.volume = (double) volume->getFloatValue();
01840             index_object++;
01841             WFloatLineEdit* inertiaMatrix = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01842             current_mass.inertiaMatrix = (double) inertiaMatrix->getFloatValue();
01843 
01844             ff->setValue(current_mass);
01845           }
01846         //*******************************************************************************************************************
01847         else if( DataPtr<RigidMass<2, float> > * ff = dynamic_cast< DataPtr<RigidMass<2, float> > * >( objectGUI[index_object].first )  )
01848           {
01849             RigidMass<2, float> current_mass = ff->getValue();      
01850 
01851             WFloatLineEdit* mass = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );  
01852             current_mass.mass =  mass->getFloatValue();
01853             index_object++;
01854             WFloatLineEdit* volume = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );    
01855             current_mass.volume =  volume->getFloatValue();
01856             index_object++;
01857             WFloatLineEdit* inertiaMatrix = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01858             current_mass.inertiaMatrix = (double) inertiaMatrix->getFloatValue();
01859             index_object++;
01860             WFloatLineEdit* inertiaMassMatrix = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01861             current_mass.inertiaMassMatrix = (double) inertiaMassMatrix->getFloatValue();
01862 
01863             ff->setValue(current_mass);
01864           }
01865         else if (DataPtr<helper::io::Mesh::Material > *ff = dynamic_cast< DataPtr<helper::io::Mesh::Material > * >( objectGUI[index_object].first ))
01866           {
01867             helper::io::Mesh::Material M;  QCheckBox* checkBox;    WFloatLineEdit* value;
01868 
01869             //Diffuse
01870             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01871             M.useDiffuse = checkBox->isOn();
01872             index_object++;
01873             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     M.diffuse[i] = value->getFloatValue();index_object++;}
01874             //Ambient
01875             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01876             M.useAmbient = checkBox->isOn();
01877             index_object++;
01878             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     M.ambient[i] = value->getFloatValue();index_object++;}
01879             //Emissive
01880             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01881             M.useEmissive = checkBox->isOn();
01882             index_object++;
01883             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );   M.emissive[i] = value->getFloatValue();index_object++;}
01884             //Specular
01885             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01886             M.useSpecular = checkBox->isOn();
01887             index_object++;
01888             for (int i=0;i<4;i++) { value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     M.specular[i] = value->getFloatValue();index_object++;}
01889             //Shininess
01890             checkBox= dynamic_cast< QCheckBox *> ( objectGUI[index_object].second ); 
01891             M.useShininess = checkBox->isOn();
01892             index_object++;
01893             value = dynamic_cast< WFloatLineEdit *> ( objectGUI[index_object].second );     
01894             M.shininess = value->getFloatValue();
01895 
01896             ff->setValue(M);
01897           }
01898           }
01899         if (REINIT_FLAG)
01900           {
01901         if (sofa::core::objectmodel::BaseObject *obj = dynamic_cast< sofa::core::objectmodel::BaseObject* >(node))
01902           obj->reinit();
01903         else if (Node *n = dynamic_cast< Node *>(node)) n->reinit();
01904           }
01905       }
01906     
01907     if (visualContentModified) updateContext(dynamic_cast< Node *>(node));      
01908 
01909     updateTables();
01910     emit (objectUpdated());
01911     buttonUpdate->setEnabled(false);
01912     visualContentModified = false;
01913 
01914     
01915     setUpdates.clear();
01916       }
01917 
01918 
01919       //*******************************************************************************************************************
01920       //Update the Context of a whole node, including its childs
01921       void ModifyObject::updateContext( Node *node )
01922       {
01923     if (node == NULL) return;
01924     node->execute< sofa::simulation::UpdateVisualContextVisitor >();
01925       }
01926 
01927 
01928       void  ModifyObject::createGraphMass(QTabWidget *dialogTab)
01929       {
01930     QWidget *tabMassStats = new QWidget(); dialogTab->addTab(tabMassStats, QString("Energy Stats"));
01931     QVBoxLayout *tabMassStatsLayout = new QVBoxLayout( tabMassStats, 0, 1, "tabMassStats");
01932     
01933 
01934 #ifdef SOFA_QT4
01935     graphEnergy = new QwtPlot(QwtText("Energy"),tabMassStats);
01936 #else
01937     graphEnergy = new QwtPlot(tabMassStats,"Energy");
01938 #endif
01939     history.clear();
01940     energy_history[0].clear();
01941     energy_history[1].clear();
01942     energy_history[2].clear();
01943     
01944     energy_curve[0] = new QwtPlotCurve("Kinetic");          energy_curve[0]->attach(graphEnergy);
01945     energy_curve[1] = new QwtPlotCurve("Potential");    energy_curve[1]->attach(graphEnergy);
01946     energy_curve[2] = new QwtPlotCurve("Mechanical");   energy_curve[2]->attach(graphEnergy);
01947 
01948     energy_curve[0]->setPen(QPen(Qt::red));
01949     energy_curve[1]->setPen(QPen(Qt::green));
01950     energy_curve[2]->setPen(QPen(Qt::blue));
01951 
01952     graphEnergy->setAxisTitle(QwtPlot::xBottom, "Time/seconds");
01953     graphEnergy->setTitle("Energy Graph");
01954     graphEnergy->insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
01955 
01956     tabMassStatsLayout->addWidget(graphEnergy);
01957       }
01958 
01959       void ModifyObject::updateHistory()
01960       {
01961     if (Node *gnode = dynamic_cast<Node *>(node))
01962       {
01963         if ( gnode->mass || gnode->forceField.size() != 0)
01964           {
01965         history.push_back(gnode->getTime());       
01966         updateEnergy();
01967           }
01968       }
01969       }
01970 
01971       void ModifyObject::updateEnergy()
01972       {
01973        
01974     Node *gnode = dynamic_cast<Node *>(node);
01975       
01976     unsigned int index = energy_history[0].size();
01977     if (gnode->mass)
01978       energy_history[0].push_back(gnode->mass->getKineticEnergy());  
01979     else
01980       energy_history[0].push_back(0);
01981         
01982     if (gnode->forceField.size() != 0)
01983       energy_history[1].push_back(gnode->forceField[0]->getPotentialEnergy()); 
01984     else
01985       energy_history[1].push_back(0); 
01986 
01987     energy_history[2].push_back(energy_history[0][index] + energy_history[1][index]);
01988 
01989     if (dialogTab->currentPageIndex() == dialogTab->count()-2)
01990       {
01991         energy_curve[0]->setRawData(&history[0],&(energy_history[0][0]), history.size());
01992         energy_curve[1]->setRawData(&history[0],&(energy_history[1][0]), history.size());
01993         energy_curve[2]->setRawData(&history[0],&(energy_history[2][0]), history.size());
01994         graphEnergy->replot();
01995       }
01996 
01997       }
01998 
01999 
02000 
02001 
02002       void ModifyObject::updateTextEdit()
02003       {
02004     std::list< std::pair< Q3TextEdit*, BaseData*> >::iterator it_list_TextEdit;      
02005     for (it_list_TextEdit = list_TextEdit.begin(); it_list_TextEdit != list_TextEdit.end(); it_list_TextEdit++)
02006       {     
02007         if ((dataIndexTab.find((*it_list_TextEdit).second))->second == dialogTab->currentPageIndex())
02008           {
02009         (*it_list_TextEdit).first->setText( QString((*it_list_TextEdit).second->getValueString().c_str()));
02010           }
02011       }
02012       }
02013       //**************************************************************************************************************************************
02014       //Called each time a new step of the simulation if computed
02015       void ModifyObject::updateTables()
02016       {
02017     updateHistory();
02018     updateTextEdit();
02019     std::list< std::pair< Q3Table*, BaseData*> >::iterator it_list_Table;
02020     bool skip;
02021     for (it_list_Table = list_Table.begin(); it_list_Table != list_Table.end(); it_list_Table++)
02022       {
02023         skip = false;
02024       
02025         if ((dataIndexTab.find((*it_list_Table).second))->second != dialogTab->currentPageIndex() ) skip = true;
02026         if ( dynamic_cast<DataPtr< vector<Rigid3Types::Coord> > *> ( (*it_list_Table).second ) || 
02027          dynamic_cast<DataPtr< vector<Rigid3Types::Deriv> > *> ( (*it_list_Table).second ) || 
02028          dynamic_cast<DataPtr< vector<Rigid2Types::Coord> > *> ( (*it_list_Table).second ) || 
02029          dynamic_cast<DataPtr< vector<Rigid2Types::Deriv> > *> ( (*it_list_Table).second ) ||
02030          dynamic_cast<Data< vector<Rigid3Types::Coord> > *> ( (*it_list_Table).second ) || 
02031          dynamic_cast<Data< vector<Rigid3Types::Deriv> > *> ( (*it_list_Table).second ) || 
02032          dynamic_cast<Data< vector<Rigid2Types::Coord> > *> ( (*it_list_Table).second ) || 
02033          dynamic_cast<Data< vector<Rigid2Types::Deriv> > *> ( (*it_list_Table).second ) )
02034           {
02035         std::list< std::pair< Q3Table*, BaseData*> >::iterator it_center = it_list_Table;
02036         it_list_Table++;
02037         if (!skip) createTable((*it_list_Table).second,NULL,(*it_center).first, (*it_list_Table).first);
02038           }
02039         else if ( dynamic_cast < Data<sofa::component::misc::Monitor< Vec3Types >::MonitorData > *> ( (*it_list_Table).second ) )
02040         {
02041             std::list< std::pair< Q3Table*, BaseData*> >::iterator it_center = it_list_Table;
02042             it_list_Table++;
02043             std::list< std::pair< Q3Table*, BaseData*> >::iterator it_center2 = it_list_Table;
02044             it_list_Table++; //two times because a monitor is composed of 3 baseData
02045             if (!skip)
02046                 createTable((*it_list_Table).second,NULL,(*it_center).first,(*it_center2).first, (*it_list_Table).first);
02047         }
02048         else
02049           if (!skip) createTable((*it_list_Table).second,NULL,(*it_list_Table).first);
02050       }
02051       }      
02052 
02053 
02054       //**************************************************************************************************************************************
02055       //create or update an existing table with the contents of a field
02056       bool ModifyObject::createTable( BaseData* field,Q3GroupBox *box, Q3Table* vectorTable, Q3Table* vectorTable2, Q3Table* vectorTable3)
02057       {
02058     //********************************************************************************************************//
02059     //vector< Vec3f >
02060     if (Data< vector< Vec3f > >  *ff = dynamic_cast< Data< vector< Vec3f > >  * >( field ))
02061       {
02062         return createQtTable(ff,box,vectorTable);
02063       }
02064     //********************************************************************************************************//
02065     //vector< Vec3d >
02066     else if ( Data< vector< Vec3d> >   *ff = dynamic_cast< Data< vector< Vec3d > >   * >( field ) )
02067       {
02068         return createQtTable(ff,box,vectorTable);
02069       }
02070     //********************************************************************************************************//
02071     //vector< Vec<3, int> >
02072     else if( Data< vector< Vec< 3, int> > >  *ff = dynamic_cast< Data< vector< Vec< 3, int> > >  * >( field ))
02073       {
02074         return createQtTable(ff,box,vectorTable);
02075       }
02076     //********************************************************************************************************//
02077     //vector< Vec<3, int> >
02078     else if( Data< vector< Vec< 3, unsigned int> > >  *ff = dynamic_cast< Data< vector< Vec< 3, unsigned int> > >  * >( field ))
02079       {
02080         return createQtTable(ff,box,vectorTable);
02081       }
02082     //********************************************************************************************************//
02083     //vector< Vec3f >
02084     else if (DataPtr< vector< Vec3f > >  *ff = dynamic_cast< DataPtr< vector< Vec3f > >  * >( field ))
02085       {
02086         return createQtTable(ff,box,vectorTable);
02087       }
02088     //********************************************************************************************************//
02089     //vector< Vec3d >
02090     else if ( DataPtr< vector< Vec3d> >   *ff = dynamic_cast< DataPtr< vector< Vec3d > >   * >( field ) )
02091       {
02092         return createQtTable(ff,box,vectorTable);
02093       }
02094     //********************************************************************************************************//
02095     //vector< Vec<3, int> >
02096     else if( DataPtr< vector< Vec< 3, int> > >  *ff = dynamic_cast< DataPtr< vector< Vec< 3, int> > >  * >( field ))
02097       {
02098         return createQtTable(ff,box,vectorTable);
02099       }
02100     //********************************************************************************************************//
02101     //vector< Vec< 3, int > >
02102     else if( DataPtr< vector< Vec< 3, int> > >  *ff = dynamic_cast< DataPtr< vector< Vec< 3, int> > >  * >( field ))
02103       {
02104         return createQtTable(ff,box,vectorTable);
02105       }
02106     //********************************************************************************************************//
02107     //vector< Vec< 3, unsigned int > >
02108     else if( DataPtr< vector< Vec< 3, unsigned int> > >  *ff = dynamic_cast< DataPtr< vector< Vec< 3, unsigned int> > >  * >( field ))
02109       {
02110         return createQtTable(ff,box,vectorTable);
02111       }
02112     //********************************************************************************************************//
02113     //vector< Vec2f >
02114     else if (Data< vector< Vec2f > >  *ff = dynamic_cast< Data< vector< Vec2f > >  * >( field ))
02115       {
02116         return createQtTable(ff,box,vectorTable);
02117       }
02118     //********************************************************************************************************//
02119     //vector< Vec2d >
02120     else if ( Data< vector< Vec2d> >   *ff = dynamic_cast< Data< vector< Vec2d > >   * >( field ) )
02121       {         
02122         return createQtTable(ff,box,vectorTable);
02123       }
02124     //********************************************************************************************************//
02125     //vector< Vec< 2, int> >
02126     else if(  Data< vector< Vec< 2, int> > >   *ff = dynamic_cast< Data< vector< Vec< 2, int> > >   * >( field ))
02127       {
02128         return createQtTable(ff,box,vectorTable);
02129       }
02130     //********************************************************************************************************//
02131     //vector< Vec< 2, unsigned int> >
02132     else if(  Data< vector< Vec< 2, unsigned int> > >   *ff = dynamic_cast< Data< vector< Vec< 2, unsigned  int> > >   * >( field ))
02133       {
02134         return createQtTable(ff,box,vectorTable);
02135       }
02136     //********************************************************************************************************//
02137     //vector< Vec2f >
02138     else if (DataPtr< vector< Vec2f > >  *ff = dynamic_cast< DataPtr< vector< Vec2f > >  * >( field ))
02139       {
02140         return createQtTable(ff,box,vectorTable);
02141       }
02142     //********************************************************************************************************//
02143     //vector< Vec2d >
02144     else if ( DataPtr< vector< Vec2d> >   *ff = dynamic_cast< DataPtr< vector< Vec2d > >   * >( field ) )
02145       {         
02146         return createQtTable(ff,box,vectorTable);
02147       }
02148     //********************************************************************************************************//
02149     //vector< Vec< 2, int> >
02150     else if(  DataPtr< vector< Vec< 2, int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 2, int> > >   * >( field ))
02151       {
02152         return createQtTable(ff,box,vectorTable);
02153       }
02154     //********************************************************************************************************//
02155     //vector< Vec< 2, unsigned int> >
02156     else if(  DataPtr< vector< Vec< 2, unsigned int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 2, unsigned int> > >   * >( field ))
02157       {
02158         return createQtTable(ff,box,vectorTable);
02159       }
02160     //********************************************************************************************************//
02161     //vector< Vec1f >
02162     else if (Data< vector< Vec1f > >  *ff = dynamic_cast< Data< vector< Vec1f > >  * >( field ))
02163       {
02164         return createQtTable(ff,box,vectorTable);
02165       }
02166     //********************************************************************************************************//
02167     //vector< Vec1d >
02168     else if ( Data< vector< Vec1d> >   *ff = dynamic_cast< Data< vector< Vec1d > >   * >( field ) )
02169       {         
02170         return createQtTable(ff,box,vectorTable);
02171       }
02172     //********************************************************************************************************//
02173     //vector< Vec< 1, int> >
02174     else if(  Data< vector< Vec< 1, int> > >   *ff = dynamic_cast< Data< vector< Vec< 1, int> > >   * >( field ))
02175       {
02176         return createQtTable(ff,box,vectorTable);
02177       }
02178     //********************************************************************************************************//
02179     //vector< Vec< 1, unsigned int> >
02180     else if(  Data< vector< Vec< 1, unsigned int> > >   *ff = dynamic_cast< Data< vector< Vec< 1, unsigned  int> > >   * >( field ))
02181       {
02182         return createQtTable(ff,box,vectorTable);
02183       }
02184     //********************************************************************************************************//
02185     //vector< Vec1f >
02186     else if (DataPtr< vector< Vec1f > >  *ff = dynamic_cast< DataPtr< vector< Vec1f > >  * >( field ))
02187       {
02188         return createQtTable(ff,box,vectorTable);
02189       }
02190     //********************************************************************************************************//
02191     //vector< Vec1d >
02192     else if ( DataPtr< vector< Vec1d> >   *ff = dynamic_cast< DataPtr< vector< Vec1d > >   * >( field ) )
02193       {         
02194         return createQtTable(ff,box,vectorTable);
02195       }
02196     //********************************************************************************************************//
02197     //vector< Vec< 1, int> >
02198     else if(  DataPtr< vector< Vec< 1, int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 1, int> > >   * >( field ))
02199       {
02200         return createQtTable(ff,box,vectorTable);
02201       }
02202     //********************************************************************************************************//
02203     //vector< Vec< 1, unsigned int> >
02204     else if(  DataPtr< vector< Vec< 1, unsigned int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 1, unsigned int> > >   * >( field ))
02205       {
02206         return createQtTable(ff,box,vectorTable);
02207       }
02208     //********************************************************************************************************//
02209     //vector< double >
02210     else if(  Data< vector< double > >   *ff = dynamic_cast< Data< vector< double> >   * >( field))
02211       {
02212         return createQtTable(ff,box,vectorTable);
02213       }
02214     //********************************************************************************************************//
02215     //vector< float >
02216     else if(  Data< vector< float > >   *ff = dynamic_cast< Data< vector< float> >   * >( field))
02217       { 
02218         return createQtTable(ff,box,vectorTable);
02219       }
02220     //********************************************************************************************************//
02221     //vector< int >
02222     else if(  Data< vector< int > >   *ff = dynamic_cast< Data< vector< int> >   * >( field))
02223       { 
02224         return createQtTable(ff,box,vectorTable);
02225       }
02226     //********************************************************************************************************//
02227     //vector< unsigned int >
02228     else if(  Data< vector< unsigned int > >   *ff = dynamic_cast< Data< vector< unsigned int> >   * >( field))
02229       { 
02230         return createQtTable(ff,box,vectorTable);
02231       }    
02232     //********************************************************************************************************//
02233     //vector< std::string >
02234     else if(  Data< vector< std::string > >   *ff = dynamic_cast< Data< vector< std::string> >   * >( field))
02235       { 
02236         return createQtTable(ff,box,vectorTable);
02237       }
02238     //********************************************************************************************************//
02239     //vector< double >
02240     else if(  DataPtr< vector< double > >   *ff = dynamic_cast< DataPtr< vector< double> >   * >( field))
02241       {
02242         return createQtTable(ff,box,vectorTable);
02243       }
02244     //********************************************************************************************************//
02245     //vector< float >
02246     else if(  DataPtr< vector< float > >   *ff = dynamic_cast< DataPtr< vector< float> >   * >( field))
02247       { 
02248         return createQtTable(ff,box,vectorTable);
02249       }
02250     //********************************************************************************************************//
02251     //vector< int >
02252     else if(  DataPtr< vector< int > >   *ff = dynamic_cast< DataPtr< vector< int> >   * >( field))
02253       { 
02254         return createQtTable(ff,box,vectorTable);
02255       }
02256     //********************************************************************************************************//
02257     //vector< unsigned int >
02258     else if(  DataPtr< vector< unsigned int > >   *ff = dynamic_cast< DataPtr< vector< unsigned int> >   * >( field))
02259       { 
02260         return createQtTable(ff,box,vectorTable);
02261       }
02262     //********************************************************************************************************//
02263     //vector< std::string >
02264     else if(  DataPtr< vector< std::string > >   *ff = dynamic_cast< DataPtr< vector< std::string> >   * >( field))
02265       { 
02266         return createQtTable(ff,box,vectorTable);
02267       }
02268     //********************************************************************************************************//
02269     //vector< double >
02270     else if(  Data<sofa::component::topology::PointData< double > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< double> >   * >( field))
02271       {
02272         return createQtTable(ff,box,vectorTable);
02273       }
02274     //********************************************************************************************************//
02275     //vector< float >
02276     else if(  Data<sofa::component::topology::PointData< float > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< float> >   * >( field))
02277       { 
02278         return createQtTable(ff,box,vectorTable);
02279       }
02280     //********************************************************************************************************//
02281     //vector< int >
02282     else if(  Data<sofa::component::topology::PointData< int > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< int> >   * >( field))
02283       { 
02284         return createQtTable(ff,box,vectorTable);
02285       }
02286     //********************************************************************************************************//
02287     //vector< unsigned int >
02288     else if(  Data<sofa::component::topology::PointData< unsigned int > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< unsigned int> >   * >( field))
02289       { 
02290         return createQtTable(ff,box,vectorTable);
02291       }
02292     //********************************************************************************************************//
02293     
02294     else if(  Data<sofa::component::misc::Monitor< Vec3dTypes >::MonitorData >  *ff = dynamic_cast< Data<sofa::component::misc::Monitor< Vec3dTypes >::MonitorData >   * >( field))
02295     {
02296       return createMonitorQtTable < Vec3dTypes >(ff,box,vectorTable, vectorTable2, vectorTable3);
02297     }
02298     
02299     //********************************************************************************************************//
02300     else if(  Data<sofa::component::misc::Monitor< Vec3fTypes >::MonitorData >  *ff = dynamic_cast< Data<sofa::component::misc::Monitor< Vec3fTypes >::MonitorData >   * >( field))
02301       {
02302         return createMonitorQtTable < Vec3fTypes >(ff,box,vectorTable, vectorTable2, vectorTable3);
02303     }
02304     //********************************************************************************************************//    
02305     //vector<Rigid3dTypes::Coord>
02306     else if (DataPtr< vector<Rigid3fTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid3fTypes::Coord>  >   * >( field ))
02307       {
02308         return createQtTable(ff,box,vectorTable, vectorTable2);
02309       }
02310     //********************************************************************************************************//
02311     //vector<Rigid3dfTypes::Deriv> && vector<Rigid3ffTypes::Deriv>
02312     else if (DataPtr< vector<Rigid3fTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid3fTypes::Deriv>  >   * >( field ))
02313       {
02314         return createQtTable(ff,box,vectorTable, vectorTable2);
02315       }
02316     //********************************************************************************************************//
02317     //vector<Rigid3dfTypes::Coord>
02318     else if (Data< vector<Rigid3fTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid3fTypes::Coord>  >   * >( field ))
02319       {
02320         return createQtTable(ff,box,vectorTable, vectorTable2);
02321       }
02322     //********************************************************************************************************//
02323     //vector<Rigid3dfTypes::Deriv> && vector<Rigid3ffTypes::Deriv>
02324     else if (Data< vector<Rigid3fTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid3fTypes::Deriv>  >   * >( field ))
02325       {
02326         return createQtTable(ff,box,vectorTable, vectorTable2);
02327       }
02328     //********************************************************************************************************//
02329     //vector<Rigid2fTypes::Coord>
02330     else if (DataPtr< vector<Rigid2fTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid2fTypes::Coord>  >   * >( field ))
02331       {
02332         return createQtTable(ff,box,vectorTable, vectorTable2);
02333       }
02334     //********************************************************************************************************//
02335     //vector<Rigid2dfTypes::Deriv>
02336     else if (DataPtr< vector<Rigid2fTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid2fTypes::Deriv>  >   * >( field ))
02337       {
02338         return createQtTable(ff,box,vectorTable, vectorTable2);
02339       }
02340     //********************************************************************************************************//
02341     //vector<Rigid2fTypes::Coord>
02342     else if (Data< vector<Rigid2fTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid2fTypes::Coord>  >   * >( field ))
02343       {
02344         return createQtTable(ff,box,vectorTable, vectorTable2);
02345       }
02346     //********************************************************************************************************//
02347     //vector<Rigid2dfTypes::Deriv>
02348     else if (Data< vector<Rigid2fTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid2fTypes::Deriv>  >   * >( field ))
02349       {
02350         return createQtTable(ff,box,vectorTable, vectorTable2);
02351       }
02352 
02353     //********************************************************************************************************//    
02354     //vector<Rigid3ddTypes::Coord>
02355     else if (DataPtr< vector<Rigid3dTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid3dTypes::Coord>  >   * >( field ))
02356       {
02357         return createQtTable(ff,box,vectorTable, vectorTable2);
02358       }
02359     //********************************************************************************************************//
02360     //vector<Rigid3ddTypes::Deriv> && vector<Rigid3fdTypes::Deriv>
02361     else if (DataPtr< vector<Rigid3dTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid3dTypes::Deriv>  >   * >( field ))
02362       {
02363         return createQtTable(ff,box,vectorTable, vectorTable2);
02364       }
02365     //********************************************************************************************************//
02366     //vector<Rigid3ddTypes::Coord>
02367     else if (Data< vector<Rigid3dTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid3dTypes::Coord>  >   * >( field ))
02368       {
02369         return createQtTable(ff,box,vectorTable, vectorTable2);
02370       }
02371     //********************************************************************************************************//
02372     //vector<Rigid3ddTypes::Deriv> && vector<Rigid3fdTypes::Deriv>
02373     else if (Data< vector<Rigid3dTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid3dTypes::Deriv>  >   * >( field ))
02374       {
02375         return createQtTable(ff,box,vectorTable, vectorTable2);
02376       }
02377     //********************************************************************************************************//
02378     //vector<Rigid2dTypes::Coord>
02379     else if (DataPtr< vector<Rigid2dTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid2dTypes::Coord>  >   * >( field ))
02380       {
02381         return createQtTable(ff,box,vectorTable, vectorTable2);
02382       }
02383     //********************************************************************************************************//
02384     //vector<Rigid2ddTypes::Deriv>
02385     else if (DataPtr< vector<Rigid2dTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid2dTypes::Deriv>  >   * >( field ))
02386       {
02387         return createQtTable(ff,box,vectorTable, vectorTable2);
02388       }
02389     //********************************************************************************************************//
02390     //vector<Rigid2dTypes::Coord>
02391     else if (Data< vector<Rigid2dTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid2dTypes::Coord>  >   * >( field ))
02392       {
02393         return createQtTable(ff,box,vectorTable, vectorTable2);
02394       }
02395     //********************************************************************************************************//
02396     //PointSubset
02397     else if (Data< vector<Rigid2dTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid2dTypes::Deriv>  >   * >( field ))
02398       {
02399         return createQtTable(ff,box,vectorTable, vectorTable2);
02400       }
02401     else if (Data< PointSubset > *ff = dynamic_cast< Data< PointSubset > *>(field))
02402       {
02403         PointSubset new_value; 
02404         
02405         for (int i=0; i<vectorTable->numRows(); ++i)
02406           {
02407         QString value = vectorTable->text(i,0);
02408         if (value.isEmpty()) 
02409           {
02410             new_value.push_back(0);
02411             vectorTable->setText(i,0,QString("0"));
02412           }
02413         else 
02414           new_value.push_back( atoi(value) );                       
02415           }
02416         ff->setValue( new_value );
02417         changeValue();
02418       }
02419     //********************************************************************************************************//
02420     else if (DataPtr< PointSubset > *ff = dynamic_cast< DataPtr< PointSubset > *>(field))
02421       {
02422         PointSubset new_value; 
02423         
02424         for (int i=0; i<vectorTable->numRows(); ++i)
02425           {
02426         QString value = vectorTable->text(i,0);
02427         if (value.isEmpty()) 
02428           {
02429             new_value.push_back(0);
02430             vectorTable->setText(i,0,QString("0"));
02431           }
02432         else 
02433           new_value.push_back( atoi(value) );                       
02434           }
02435         ff->setValue( new_value );
02436         changeValue();
02437       }
02438     //********************************************************************************************************//
02439     //vector<LaparoscopicRigid3Types::Coord>
02440     else if (DataPtr< vector<LaparoscopicRigid3Types::Coord> >  *ff = dynamic_cast< DataPtr< vector<LaparoscopicRigid3Types::Coord>  >   * >( field ))
02441       {
02442           
02443         if (!vectorTable) 
02444           {                     
02445         if (ff->getValue().size() == 0 && !EMPTY_FLAG)  return false;
02446         box->setColumns(1);
02447         new QLabel("Translation", box);
02448               
02449         vectorTable = new Q3Table(ff->getValue().size(),1, box);
02450         vectorTable->setReadOnly(false);
02451         
02452         list_Table.push_back(std::make_pair(vectorTable, field));
02453         vectorTable->horizontalHeader()->setLabel(0,QString("X"));      vectorTable->setColumnStretchable(0,true);
02454               
02455         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
02456               
02457         new QLabel("Orientation", box);
02458               
02459         vectorTable2 = new Q3Table(ff->getValue().size(),4, box);
02460         list_Table.push_back(std::make_pair(vectorTable2, field));
02461         vectorTable2->horizontalHeader()->setLabel(0,QString("X"));     vectorTable2->setColumnStretchable(0,true);
02462         vectorTable2->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable2->setColumnStretchable(1,true);
02463         vectorTable2->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable2->setColumnStretchable(2,true);
02464         vectorTable2->horizontalHeader()->setLabel(3,QString("W"));      vectorTable2->setColumnStretchable(3,true);
02465               
02466         connect( vectorTable2, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
02467               
02468           }
02469         vector<LaparoscopicRigid3Types::Coord> value = ff->getValue();
02470           
02471           
02472         for (unsigned int i=0; i<ff->getValue().size(); i++)
02473           {
02474         std::ostringstream oss;
02475               
02476         {                   
02477           oss << value[i].getTranslation();
02478           vectorTable->setText(i,0,std::string(oss.str()).c_str());
02479         }
02480         std::ostringstream oss2[4];
02481         for (int j=0; j<4; j++)
02482           { 
02483             oss2[j] << value[i].getOrientation()[j];
02484             vectorTable2->setText(i,j,std::string(oss2[j].str()).c_str());
02485           }
02486           }
02487         return true;
02488       }
02489     //********************************************************************************************************//
02490     //vector<LaparoscopicRigid3Types::Deriv>
02491     else if (DataPtr< vector<LaparoscopicRigid3Types::Deriv> >  *ff = dynamic_cast< DataPtr< vector<LaparoscopicRigid3Types::Deriv>  >   * >( field ))
02492       {
02493           
02494         if (!vectorTable) 
02495           {                     
02496         if (ff->getValue().size() == 0 && !EMPTY_FLAG)  return false;
02497         box->setColumns(1);
02498         new QLabel("Translation", box);
02499               
02500         vectorTable = new Q3Table(ff->getValue().size(),1, box);
02501         vectorTable->setReadOnly(false);
02502         
02503         list_Table.push_back(std::make_pair(vectorTable, field));
02504         vectorTable->horizontalHeader()->setLabel(0,QString("X"));  vectorTable->setColumnStretchable(0,true);
02505               
02506         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
02507               
02508         new QLabel("Orientation", box);
02509               
02510         vectorTable2 = new Q3Table(ff->getValue().size(),3, box);
02511         list_Table.push_back(std::make_pair(vectorTable2, field));
02512         vectorTable2->horizontalHeader()->setLabel(0,QString("X"));  vectorTable2->setColumnStretchable(0,true);
02513         vectorTable2->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable2->setColumnStretchable(1,true);
02514         vectorTable2->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable2->setColumnStretchable(2,true);
02515               
02516         connect( vectorTable2, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
02517               
02518           }
02519         vector<LaparoscopicRigid3Types::Deriv> value = ff->getValue();
02520           
02521           
02522         for (unsigned int i=0; i<ff->getValue().size(); i++)
02523           {
02524         std::ostringstream oss;
02525               
02526         {                   
02527           oss << value[i].getVTranslation();
02528           vectorTable->setText(i,0,std::string(oss.str()).c_str());
02529         }   
02530         std::ostringstream oss2[3];
02531         for (int j=0; j<3; j++)
02532           { 
02533             oss2[j] << value[i].getVOrientation()[j];
02534             vectorTable2->setText(i,j,std::string(oss2[j].str()).c_str());
02535           }
02536           }
02537         return true;
02538           
02539       }
02540 #ifndef WIN32
02541     //********************************************************************************************************//
02542     //vector<SpringForceField< Vec6dTypes >::Spring> 
02543     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6dTypes>::Spring > >  * >( field ))
02544       {
02545         return createQtSpringTable<6,double>(ff,box,vectorTable);
02546       }
02547     //********************************************************************************************************//
02548     //vector<SpringForceField< Vec6fTypes >::Spring> 
02549     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6fTypes>::Spring > >  * >( field ))
02550       {
02551         return createQtSpringTable<6,float>(ff,box,vectorTable);
02552       }
02553 
02554     //********************************************************************************************************//
02555     //vector<SpringForceField< Vec3dTypes >::Spring> 
02556     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3dTypes>::Spring > >  * >( field ))
02557       {
02558         return createQtSpringTable<3,double>(ff,box,vectorTable);
02559       }
02560     //********************************************************************************************************//
02561     //vector<SpringForceField< Vec3fTypes >::Spring> 
02562     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3fTypes>::Spring > >  * >( field ))
02563       {
02564         return createQtSpringTable<3,float>(ff,box,vectorTable);
02565       }
02566     //********************************************************************************************************//
02567     //vector<SpringForceField< Vec2dTypes >::Spring> 
02568     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2dTypes>::Spring > >  * >( field ))
02569       {
02570         return createQtSpringTable<2,double>(ff,box,vectorTable);
02571       }
02572     //********************************************************************************************************//
02573     //vector<SpringForceField< Vec2fTypes >::Spring> 
02574     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2fTypes>::Spring > >  * >( field ))
02575       {
02576         return createQtSpringTable<2,float>(ff,box,vectorTable);
02577       }
02578     //********************************************************************************************************//
02579     //vector<SpringForceField< Vec1dTypes >::Spring> 
02580     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1dTypes>::Spring > >  * >( field ))
02581       {
02582         return createQtSpringTable<1,double>(ff,box,vectorTable);
02583       }
02584     //********************************************************************************************************//
02585     //vector<SpringForceField< Vec1fTypes >::Spring> 
02586     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1fTypes>::Spring > >  * >( field ))
02587       {
02588         return createQtSpringTable<1,float>(ff,box,vectorTable);
02589       }
02590     //********************************************************************************************************//
02591     //vector<JointSpringForceField< Rigid3dTypes >::Spring> 
02592     else if (Data< vector<sofa::component::forcefield::JointSpringForceField< Rigid3dTypes>::Spring > >  *ff = dynamic_cast< Data< vector<sofa::component::forcefield::JointSpringForceField< Rigid3dTypes>::Spring > >  * >( field ))
02593       {
02594         return createQtRigidSpringTable<double>(ff,box,vectorTable);
02595       }
02596 
02597     //********************************************************************************************************//
02598     //vector<JointSpringForceField< Rigid3fTypes >::Spring> 
02599     else if (Data< vector<sofa::component::forcefield::JointSpringForceField< Rigid3fTypes>::Spring > >  *ff = dynamic_cast< Data< vector<sofa::component::forcefield::JointSpringForceField< Rigid3fTypes>::Spring > >  * >( field ))
02600       {
02601         return createQtRigidSpringTable<float>(ff,box,vectorTable);
02602       }
02603 #endif
02604 
02605     return false;     
02606       }
02607 
02608 
02609 
02610 
02611       //**************************************************************************************************************************************
02612       //save in datafield the values of the text edit
02613       void ModifyObject::saveTextEdit()
02614       {
02615     
02616     std::list< std::pair< Q3TextEdit*, core::objectmodel::BaseData*> >::iterator it_list_TextEdit;
02617     for (it_list_TextEdit = list_TextEdit.begin(); it_list_TextEdit != list_TextEdit.end(); it_list_TextEdit++)
02618       {
02619         std::string value = it_list_TextEdit->first->text().ascii();
02620         it_list_TextEdit->second->read(value);
02621       }
02622       }
02623        
02624 
02625       //**************************************************************************************************************************************
02626       //save in datafield the values of the tables
02627       void ModifyObject::saveTables()
02628       {
02629     
02630     std::list< std::pair< Q3Table*, BaseData*> >::iterator it_list_Table;
02631     for (it_list_Table = list_Table.begin(); it_list_Table != list_Table.end(); it_list_Table++)
02632       {
02633 
02634         if (setUpdates.find(getData(it_list_Table->first)) == setUpdates.end()) continue;
02635         storeTable(it_list_Table);
02636       }
02637       }
02638        
02639       
02640       //**************************************************************************************************************************************
02641       //Read the content of a QTable and store its values in a datafield
02642       void ModifyObject::storeTable(std::list< std::pair< Q3Table*, BaseData*> >::
02643       iterator &it_list_table)
02644       {
02646       //it_list_table->first is a Q3Table* table
02647       //it_list_table->second is a BaseData* field
02649       
02650     //**************************************************************************************************************************************
02651     if (Data< vector< Vec<3,float> > >  *ff = dynamic_cast< Data< vector< Vec<3,float> > >  * >( it_list_table->second ))
02652       {
02653         storeQtTable(it_list_table, ff);
02654       }      
02655     //**************************************************************************************************************************************
02656     else if ( Data< vector< Vec<3,double> > >   *ff = dynamic_cast< Data< vector< Vec<3,double> > >   * >( it_list_table->second ) )
02657       {
02658         storeQtTable(it_list_table, ff);
02659       }
02660     //**************************************************************************************************************************************
02661     else if( Data< vector< Vec< 3, int> > >  *ff = dynamic_cast< Data< vector< Vec< 3, int> > >  * >( it_list_table->second ))
02662       {
02663         storeQtTable(it_list_table, ff);
02664       }
02665     //**************************************************************************************************************************************
02666     else if( Data< vector< Vec< 3, unsigned int> > >   *ff = dynamic_cast< Data< vector< Vec< 3, unsigned int> > >   * >( it_list_table->second ))
02667       {
02668         storeQtTable(it_list_table, ff);   
02669       }
02670     //**************************************************************************************************************************************
02671     else if ( DataPtr< vector< Vec<3,float> > >  *ff = dynamic_cast< DataPtr< vector< Vec<3,float> > >  * >( it_list_table->second ))
02672       {
02673         storeQtTable(it_list_table, ff);        
02674       }
02675     //**************************************************************************************************************************************
02676     else if ( DataPtr< vector< Vec<3,double> > >   *ff = dynamic_cast< DataPtr< vector< Vec<3,double> > >   * >( it_list_table->second ) )
02677       {
02678         storeQtTable(it_list_table, ff);
02679       }
02680     //**************************************************************************************************************************************
02681     else if( DataPtr< vector< Vec< 3, int> > >  *ff = dynamic_cast< DataPtr< vector< Vec< 3, int> > >  * >( it_list_table->second ))
02682       {
02683         storeQtTable(it_list_table, ff);
02684       }
02685     //**************************************************************************************************************************************
02686     else if(  DataPtr< vector< Vec< 3, unsigned int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 3, unsigned int> > >   * >( it_list_table->second ))
02687       {
02688         storeQtTable(it_list_table, ff);   
02689       }
02690     //**************************************************************************************************************************************
02691     else if ( Data< vector< Vec<2,float> > >  *ff = dynamic_cast< Data< vector< Vec<2,float> > >  * >( it_list_table->second ))
02692       {     
02693         storeQtTable(it_list_table, ff);
02694       }
02695     //**************************************************************************************************************************************
02696     else if ( Data< vector< Vec<2,double> > >   *ff = dynamic_cast< Data< vector< Vec<2,double> > >   * >( it_list_table->second ) )
02697       {   
02698         storeQtTable(it_list_table, ff);
02699       }
02700     //**************************************************************************************************************************************
02701     else if( Data< vector< Vec< 2, int> > >   *ff = dynamic_cast< Data< vector< Vec< 2, int> > >   * >( it_list_table->second ))
02702       {
02703         storeQtTable(it_list_table, ff);
02704       } 
02705     //**************************************************************************************************************************************
02706     else if( Data< vector< Vec< 2, unsigned int> > >   *ff = dynamic_cast< Data< vector< Vec< 2, unsigned int> > >   * >( it_list_table->second ))
02707       {
02708         storeQtTable(it_list_table, ff);   
02709       }
02710     //**************************************************************************************************************************************
02711     else if (DataPtr< vector< Vec<2,float> > >  *ff = dynamic_cast< DataPtr< vector< Vec<2,float> > >  * >( it_list_table->second ))
02712       {
02713         storeQtTable(it_list_table, ff);
02714       }
02715     //**************************************************************************************************************************************
02716     else if ( DataPtr< vector< Vec<2,double> > >   *ff = dynamic_cast< DataPtr< vector< Vec<2,double> > >   * >( it_list_table->second ) )
02717       {         
02718         storeQtTable(it_list_table, ff);
02719       }
02720     //**************************************************************************************************************************************
02721     else if(  DataPtr< vector< Vec< 2, int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 2, int> > >   * >( it_list_table->second ))
02722       {
02723         storeQtTable(it_list_table, ff);   
02724       }
02725     //**************************************************************************************************************************************
02726     else if(  DataPtr< vector< Vec< 2, unsigned int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 2, unsigned int> > >   * >( it_list_table->second ))
02727       {
02728         storeQtTable(it_list_table, ff);   
02729       }
02730     //**************************************************************************************************************************************
02731     else if ( Data< vector< Vec<1,float> > >  *ff = dynamic_cast< Data< vector< Vec<1,float> > >  * >( it_list_table->second ))
02732       {     
02733         storeQtTable(it_list_table, ff);
02734       }
02735     //**************************************************************************************************************************************
02736     else if ( Data< vector< Vec<1,double> > >   *ff = dynamic_cast< Data< vector< Vec<1,double> > >   * >( it_list_table->second ) )
02737       {   
02738         storeQtTable(it_list_table, ff);
02739       }
02740     //**************************************************************************************************************************************
02741     else if( Data< vector< Vec< 1, int> > >   *ff = dynamic_cast< Data< vector< Vec< 1, int> > >   * >( it_list_table->second ))
02742       {
02743         storeQtTable(it_list_table, ff);
02744       } 
02745     //**************************************************************************************************************************************
02746     else if( Data< vector< Vec< 1, unsigned int> > >   *ff = dynamic_cast< Data< vector< Vec< 1, unsigned int> > >   * >( it_list_table->second ))
02747       {
02748         storeQtTable(it_list_table, ff);   
02749       }
02750     //**************************************************************************************************************************************
02751     else if (DataPtr< vector< Vec<1,float> > >  *ff = dynamic_cast< DataPtr< vector< Vec<1,float> > >  * >( it_list_table->second ))
02752       {
02753         storeQtTable(it_list_table, ff);
02754       }
02755     //**************************************************************************************************************************************
02756     else if ( DataPtr< vector< Vec<1,double> > >   *ff = dynamic_cast< DataPtr< vector< Vec<1,double> > >   * >( it_list_table->second ) )
02757       {         
02758         storeQtTable(it_list_table, ff);
02759       }
02760     //**************************************************************************************************************************************
02761     else if(  DataPtr< vector< Vec< 1, int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 1, int> > >   * >( it_list_table->second ))
02762       {
02763         storeQtTable(it_list_table, ff);   
02764       }
02765     //**************************************************************************************************************************************
02766     else if(  DataPtr< vector< Vec< 1, unsigned int> > >   *ff = dynamic_cast< DataPtr< vector< Vec< 1, unsigned int> > >   * >( it_list_table->second ))
02767       {
02768         storeQtTable(it_list_table, ff);   
02769       }
02770     //**************************************************************************************************************************************
02771     else if(  Data< vector< double > >   *ff = dynamic_cast< Data< vector< double> >   * >( it_list_table->second))
02772       { 
02773         storeQtTable(it_list_table, ff);
02774       }
02775     //**************************************************************************************************************************************    
02776     else if(  Data< vector< float > >   *ff = dynamic_cast< Data< vector< float> >   * >( it_list_table->second))
02777       {         
02778         storeQtTable(it_list_table, ff);
02779       }
02780     //**************************************************************************************************************************************    
02781     else if(  Data< vector< int > >   *ff = dynamic_cast< Data< vector< int> >   * >( it_list_table->second))
02782       { 
02783         storeQtTable(it_list_table, ff);
02784       }      
02785     //**************************************************************************************************************************************    
02786     else if(  Data< vector< std::string > >   *ff = dynamic_cast< Data< vector< std::string > >   * >( it_list_table->second))
02787       { 
02788         storeQtTable(it_list_table, ff);
02789       }
02790     //**************************************************************************************************************************************    
02791     else if(  Data< vector< unsigned int > >   *ff = dynamic_cast< Data< vector< unsigned int> >   * >( it_list_table->second))
02792       { 
02793         storeQtTable(it_list_table, ff);
02794       }
02795     //**************************************************************************************************************************************
02796     else if(  DataPtr< vector< double > >   *ff = dynamic_cast< DataPtr< vector< double> >   * >( it_list_table->second))
02797       { 
02798         storeQtTable(it_list_table, ff);
02799       }
02800     //**************************************************************************************************************************************    
02801     else if(  DataPtr< vector< float > >   *ff = dynamic_cast< DataPtr< vector< float> >   * >( it_list_table->second))
02802       {
02803         storeQtTable(it_list_table, ff);
02804       }
02805     //**************************************************************************************************************************************    
02806     else if(  DataPtr< vector< int > >   *ff = dynamic_cast< DataPtr< vector< int> >   * >( it_list_table->second))
02807       { 
02808         storeQtTable(it_list_table, ff);
02809       }
02810     //**************************************************************************************************************************************    
02811     else if(  DataPtr< vector< unsigned int > >   *ff = dynamic_cast< DataPtr< vector< unsigned int> >   * >( it_list_table->second))
02812       { 
02813         storeQtTable(it_list_table, ff);
02814       }
02815     //**************************************************************************************************************************************
02816     else if(  Data<sofa::component::topology::PointData< double > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< double> >   * >( it_list_table->second))
02817       { 
02818         storeQtTable(it_list_table, ff);
02819       }
02820     //**************************************************************************************************************************************    
02821     else if(  Data<sofa::component::topology::PointData< float > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< float> >   * >( it_list_table->second))
02822       {         
02823         storeQtTable(it_list_table, ff);
02824       }
02825     //**************************************************************************************************************************************    
02826     else if(  Data<sofa::component::topology::PointData< int > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< int> >   * >( it_list_table->second))
02827       { 
02828         storeQtTable(it_list_table, ff);
02829       }
02830     //**************************************************************************************************************************************    
02831     else if(  Data<sofa::component::topology::PointData< unsigned int > >   *ff = dynamic_cast< Data<sofa::component::topology::PointData< unsigned int> >   * >( it_list_table->second))
02832       { 
02833         storeQtTable(it_list_table, ff);
02834       }
02835     //********************************************************************************************************//    
02836     //vector<Rigid3dfTypes::Coord>
02837     else if (Data< vector<Rigid3fTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid3fTypes::Coord>  >   * >( it_list_table->second ))
02838       {
02839         storeQtRigid3Table(it_list_table, ff);
02840       }
02841     //********************************************************************************************************//    
02842     //vector<Rigid3dfTypes::Coord>
02843     else if (Data< vector<Rigid2fTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid2fTypes::Coord>  >   * >( it_list_table->second ))
02844       {
02845         storeQtRigid2Table(it_list_table, ff);
02846       }
02847     //********************************************************************************************************//    
02848     //vector<Rigid3dfTypes::Coord>
02849     else if (DataPtr< vector<Rigid3fTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid3fTypes::Coord>  >   * >( it_list_table->second ))
02850       {
02851         storeQtRigid3Table(it_list_table, ff);
02852       }
02853     //********************************************************************************************************//    
02854     //vector<Rigid3dfTypes::Coord>
02855     else if (DataPtr< vector<Rigid2fTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid2fTypes::Coord>  >   * >( it_list_table->second ))
02856       {
02857         storeQtRigid2Table(it_list_table, ff);
02858       }
02859     //********************************************************************************************************//    
02860     //vector<Rigid3dfTypes::Deriv>
02861     else if (Data< vector<Rigid3fTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid3fTypes::Deriv>  >   * >( it_list_table->second ))
02862       {
02863         storeQtRigid3Table(it_list_table, ff);
02864       }
02865     //********************************************************************************************************//    
02866     //vector<Rigid3dfTypes::Deriv>
02867     else if (Data< vector<Rigid2fTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid2fTypes::Deriv>  >   * >( it_list_table->second ))
02868       {
02869         storeQtRigid2Table(it_list_table, ff);
02870       }
02871     //********************************************************************************************************//    
02872     //vector<Rigid3dfTypes::Deriv>
02873     else if (DataPtr< vector<Rigid3fTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid3fTypes::Deriv>  >   * >( it_list_table->second ))
02874       {
02875         storeQtRigid3Table(it_list_table, ff);
02876       }
02877     //********************************************************************************************************//    
02878     //vector<Rigid3dfTypes::Deriv>
02879     else if (DataPtr< vector<Rigid2fTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid2fTypes::Deriv>  >   * >( it_list_table->second ))
02880       {
02881         storeQtRigid2Table(it_list_table, ff);
02882       }
02883     //********************************************************************************************************//    
02884     //vector<Rigid3ddTypes::Coord>
02885     else if (Data< vector<Rigid3dTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid3dTypes::Coord>  >   * >( it_list_table->second ))
02886       {
02887         storeQtRigid3Table(it_list_table, ff);
02888       }
02889     //********************************************************************************************************//    
02890     //vector<Rigid3ddTypes::Coord>
02891     else if (Data< vector<Rigid2dTypes::Coord> >  *ff = dynamic_cast< Data< vector<Rigid2dTypes::Coord>  >   * >( it_list_table->second ))
02892       {
02893         storeQtRigid2Table(it_list_table, ff);
02894       }
02895     //********************************************************************************************************//    
02896     //vector<Rigid3ddTypes::Coord>
02897     else if (DataPtr< vector<Rigid3dTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid3dTypes::Coord>  >   * >( it_list_table->second ))
02898       {
02899         storeQtRigid3Table(it_list_table, ff);
02900       }
02901     //********************************************************************************************************//    
02902     //vector<Rigid3ddTypes::Coord>
02903     else if (DataPtr< vector<Rigid2dTypes::Coord> >  *ff = dynamic_cast< DataPtr< vector<Rigid2dTypes::Coord>  >   * >( it_list_table->second ))
02904       {
02905         storeQtRigid2Table(it_list_table, ff);
02906       }
02907     //********************************************************************************************************//    
02908     //vector<Rigid3ddTypes::Deriv>
02909     else if (Data< vector<Rigid3dTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid3dTypes::Deriv>  >   * >( it_list_table->second ))
02910       {
02911         storeQtRigid3Table(it_list_table, ff);
02912       }
02913     //********************************************************************************************************//    
02914     //vector<Rigid3ddTypes::Deriv>
02915     else if (Data< vector<Rigid2dTypes::Deriv> >  *ff = dynamic_cast< Data< vector<Rigid2dTypes::Deriv>  >   * >( it_list_table->second ))
02916       {
02917         storeQtRigid2Table(it_list_table, ff);
02918       }
02919     //********************************************************************************************************//    
02920     //vector<Rigid3ddTypes::Deriv>
02921     else if (DataPtr< vector<Rigid3dTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid3dTypes::Deriv>  >   * >( it_list_table->second ))
02922       {
02923         storeQtRigid3Table(it_list_table, ff);
02924       }
02925     //********************************************************************************************************//    
02926     //vector<Rigid3ddTypes::Deriv>
02927     else if (DataPtr< vector<Rigid2dTypes::Deriv> >  *ff = dynamic_cast< DataPtr< vector<Rigid2dTypes::Deriv>  >   * >( it_list_table->second ))
02928       {
02929         storeQtRigid2Table(it_list_table, ff);
02930       }
02931     //**************************************************************************************************************************************    
02932     else if (  Data<sofa::component::misc::Monitor< Vec3dTypes >::MonitorData >  *ff = dynamic_cast< Data<sofa::component::misc::Monitor< Vec3dTypes >::MonitorData > * >( it_list_table->second))
02933     {
02934         storeMonitorQtTable< Vec3dTypes >(it_list_table, ff);
02935     }
02936      //**************************************************************************************************************************************
02937     else if (  Data<sofa::component::misc::Monitor< Vec3fTypes >::MonitorData >  *ff = dynamic_cast< Data<sofa::component::misc::Monitor< Vec3fTypes >::MonitorData > * >( it_list_table->second))
02938     {
02939         storeMonitorQtTable< Vec3fTypes >(it_list_table, ff);
02940     }
02941     //**************************************************************************************************************************************
02942 #ifndef WIN32
02943     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6dTypes>::Spring > >  * >( it_list_table->second ))
02944     {
02945       storeQtSpringTable<6,double>(it_list_table, ff);
02946     }
02947     //**************************************************************************************************************************************
02948     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec6fTypes>::Spring > >  * >( it_list_table->second ))
02949       {   
02950       storeQtSpringTable<6,float>(it_list_table, ff);
02951       }
02952     //**************************************************************************************************************************************
02953     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3dTypes>::Spring > >  * >( it_list_table->second ))
02954       {   
02955       storeQtSpringTable<3,double>(it_list_table, ff);
02956       }
02957     //**************************************************************************************************************************************
02958     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec3fTypes>::Spring > >  * >( it_list_table->second ))
02959       {     
02960       storeQtSpringTable<3,float>(it_list_table, ff);
02961       }
02962     //**************************************************************************************************************************************
02963     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2dTypes>::Spring > >  * >( it_list_table->second ))
02964       {     
02965       storeQtSpringTable<2,double>(it_list_table, ff);
02966       }
02967     //**************************************************************************************************************************************
02968     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec2fTypes>::Spring > >  * >( it_list_table->second ))
02969       {
02970       storeQtSpringTable<2,float>(it_list_table, ff);
02971       }
02972     //**************************************************************************************************************************************
02973     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1dTypes>::Spring > >  * >( it_list_table->second ))
02974       {
02975       storeQtSpringTable<1,double>(it_list_table, ff);
02976       }
02977     //**************************************************************************************************************************************
02978     else if (Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::SpringForceField< Vec1fTypes>::Spring > >  * >( it_list_table->second ))
02979       {
02980       storeQtSpringTable<1,float>(it_list_table, ff);
02981       }
02982     //**************************************************************************************************************************************
02983     else if (Data< sofa::helper::vector<sofa::component::forcefield::JointSpringForceField< Rigid3dTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::JointSpringForceField< Rigid3dTypes>::Spring > >  * >( it_list_table->second ))
02984       {   
02985         storeQtRigidSpringTable<double>(it_list_table, ff);
02986       }
02987     //**************************************************************************************************************************************
02988     else if (Data< sofa::helper::vector<sofa::component::forcefield::JointSpringForceField< Rigid3fTypes>::Spring > >  *ff = dynamic_cast< Data< sofa::helper::vector<sofa::component::forcefield::JointSpringForceField< Rigid3fTypes>::Spring > >  * >( it_list_table->second ))
02989       {   
02990         storeQtRigidSpringTable<float>(it_list_table, ff);
02991       }
02992 #endif
02993       }
02994 
02995       //********************************************************************************************************************
02996       void ModifyObject::createVector(   core::objectmodel::BaseData* object,const Quater<double> &value, Q3GroupBox *box)
02997       {
02998     Vec<4,double> new_value(value[0], value[1], value[2], value[3]);
02999     createVector( object,new_value, box);
03000       }
03001       //********************************************************************************************************************
03002       void ModifyObject::createVector(   core::objectmodel::BaseData* object, const Quater<float> &value, Q3GroupBox *box)
03003       {
03004     Vec<4,float> new_value(value[0], value[1], value[2], value[3]);
03005     createVector( object ,new_value, box);
03006       }
03007   
03008 
03009       //********************************************************************************************************************
03010       //TEMPLATE FUNCTIONS
03011       //********************************************************************************************************************
03012       template< int N, class T>
03013       void ModifyObject::createVector( core::objectmodel::BaseData* object,const Vec<N,T> &value, Q3GroupBox *box)
03014       {
03015     box->setColumns(N+1);
03016     WFloatLineEdit* editSFFloat[N];
03017     for (int i=0;i<N;i++)
03018       {     
03019         std::ostringstream oss;
03020         oss << "editSFFloat_" << i;
03021         editSFFloat[i] = new WFloatLineEdit( box, QString(std::string(oss.str()).c_str())   );
03022         objectGUI.push_back(std::make_pair( object,  (QObject *) editSFFloat[i]));
03023 
03024         editSFFloat[i]->setMinFloatValue( (float)-INFINITY );
03025         editSFFloat[i]->setMaxFloatValue( (float)INFINITY );
03026       }
03027     for (int i=0;i<N;i++)
03028       {
03029         editSFFloat[i]->setFloatValue((float)value[i]);
03030       }
03031     for (int i=0;i<N;i++)
03032       {
03033         connect( editSFFloat[i], SIGNAL( textChanged(const QString&) ), this, SLOT( changeValue() ) );
03034       }
03035       } 
03036       //********************************************************************************************************************
03037       template< int N, class T>
03038       void ModifyObject::storeVector(unsigned int &index, Data< Vec<N,T> > *ff)
03039       {
03040     WFloatLineEdit* editSFFloat[N];
03041     for (int i=0;i<N;i++)
03042       {
03043         editSFFloat[i] = dynamic_cast< WFloatLineEdit *> ( objectGUI[index].second ); index++;
03044       }
03045     index--;
03046     Vec<N, T> value;
03047     for (int i=0;i<N;i++)  value[i] =  (T) editSFFloat[i]->getFloatValue();
03048     ff->setValue(value);
03049       }
03050       template<class T>
03051       void ModifyObject::storeVector(unsigned int &index, Data< Quater<T> > *ff)
03052       {
03053     WFloatLineEdit* editSFFloat[4];
03054     for (int i=0;i<4;i++)
03055       {
03056         editSFFloat[i] = dynamic_cast< WFloatLineEdit *> ( objectGUI[index].second ); index++;
03057       }
03058     index--;
03059     Quater<T> value;
03060     for (int i=0;i<4;i++)  value[i] =  (T) editSFFloat[i]->getFloatValue();
03061     ff->setValue(value);
03062       }
03063   
03064       template< int N, class T>
03065       void ModifyObject::storeVector(unsigned int &index, DataPtr< Vec<N,T> > *ff)
03066       {
03067     WFloatLineEdit* editSFFloat[N];
03068     for (int i=0;i<N;i++)
03069       {
03070         editSFFloat[i] = dynamic_cast< WFloatLineEdit *> ( objectGUI[index].second ); index++;
03071       }
03072     index--;
03073 
03074     Vec<N, T> value;
03075     for (int i=0;i<N;i++)  value[i] =  (T) editSFFloat[i]->getFloatValue();
03076     ff->setValue(value);
03077       }
03078       template<class T>
03079       void ModifyObject::storeVector(unsigned int &index, DataPtr< Quater<T> > *ff)
03080       {
03081     WFloatLineEdit* editSFFloat[4];
03082     for (int i=0;i<4;i++)
03083       {
03084         editSFFloat[i] = dynamic_cast< WFloatLineEdit *> ( objectGUI[index].second ); index++;
03085       }
03086     index--;
03087     Quater<T> value;
03088     for (int i=0;i<4;i++)  value[i] =  (T) editSFFloat[i]->getFloatValue();
03089     ff->setValue(value);
03090       }
03091   
03092       template< int N, class T>
03093       void ModifyObject::storeVector(unsigned int &index, Vec<N,T> *ff)
03094       {
03095     WFloatLineEdit* editSFFloat[N];
03096     for (int i=0;i<N;i++)
03097       {
03098         editSFFloat[i] = dynamic_cast< WFloatLineEdit *> ( objectGUI[index].second ); index++;
03099       }
03100     index--;
03101     Vec<N, T> value;
03102     for (int i=0;i<N;i++)  value[i] =  (T) editSFFloat[i]->getFloatValue();
03103     *ff = value;
03104       }
03105       template<class T>
03106       void ModifyObject::storeVector(unsigned int &index, Quater<T> *ff)
03107       {
03108     WFloatLineEdit* editSFFloat[4];
03109     for (int i=0;i<4;i++)
03110       {
03111         editSFFloat[i] = dynamic_cast< WFloatLineEdit *> ( objectGUI[index].second ); index++;
03112       }
03113     index--;
03114     Quater<T> value;
03115     for (int i=0;i<4;i++)  value[i] =  (T) editSFFloat[i]->getFloatValue();
03116     *ff = value;
03117       }
03118       //********************************************************************************************************************
03119       //********************************************************************************************************************
03120       template< class T>
03121       bool ModifyObject::createQtTable(Data< sofa::helper::vector< T > > *ff, Q3GroupBox *box, Q3Table* vectorTable )
03122       {
03123     if (!vectorTable)
03124       {
03125         
03126         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
03127 
03128         box->setColumns(1);
03129 
03130         
03131         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),1);
03132         else vectorTable = new Q3Table(ff->getValue().size(),1, box);
03133     
03134         list_Table.push_back(std::make_pair(vectorTable, ff));
03135         objectGUI.push_back(std::make_pair(ff,vectorTable));
03136         vectorTable->horizontalHeader()->setLabel(0,QString("Value"));
03137         vectorTable->setColumnStretchable(0,true);
03138         
03139         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03140       }
03141 
03142     if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
03143     else      vectorTable->setNumRows(ff->getValue().size());
03144 
03145 
03146     vector< T > value = ff->getValue();
03147 
03148 
03149     for (unsigned int i=0; i<ff->getValue().size(); i++)
03150       {
03151         std::ostringstream oss;
03152         oss << value[i];
03153         vectorTable->setText(i,0,std::string(oss.str()).c_str());
03154       }
03155     return true;
03156       }
03157       //********************************************************************************************************************
03158       
03159       void ModifyObject::storeQtTable(std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< std::string > >* ff )
03160       {
03161       Q3Table* table=it_list_table->first;
03162 
03163     QString vec_value;
03164     vector< std::string > new_value;
03165     for (unsigned int i=0; i<ff->getValue().size(); i++)
03166       {
03167         vec_value = table->text(i,0);
03168         new_value.push_back( (std::string)(vec_value.ascii()) );
03169       }    
03170     ff->setValue( new_value ); 
03171       }
03172       //********************************************************************************************************************
03173       template<class T>
03174       void ModifyObject::storeQtTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< T > >* ff )
03175       {
03176       
03177       Q3Table* table=it_list_table->first;
03178       
03179     QString vec_value;
03180     vector< T > new_value;
03181     for (unsigned int i=0; i<ff->getValue().size(); i++)
03182       {
03183         vec_value = table->text(i,0);
03184         new_value.push_back( (T)atof(vec_value) );
03185       }    
03186     ff->setValue( new_value ); 
03187       }
03188       //********************************************************************************************************************
03189       //********************************************************************************************************************
03190       template< class T>
03191       bool ModifyObject::createQtTable(DataPtr< sofa::helper::vector< T > > *ff, Q3GroupBox *box, Q3Table* vectorTable )
03192       {
03193     if (!vectorTable)
03194       {
03195         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
03196 
03197         box->setColumns(1);
03198 
03199 
03200         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),1);
03201         else vectorTable = new Q3Table(ff->getValue().size(),1, box);
03202 
03203         list_Table.push_back(std::make_pair(vectorTable, ff));
03204         objectGUI.push_back(std::make_pair(ff,vectorTable));
03205 
03206         vectorTable->horizontalHeader()->setLabel(0,QString("Value"));
03207         vectorTable->setColumnStretchable(0,true);
03208          
03209         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03210       }
03211 
03212     if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
03213     else      vectorTable->setNumRows(ff->getValue().size());
03214 
03215     vector< T > value = ff->getValue();
03216 
03217     for (unsigned int i=0; i<ff->getValue().size(); i++)
03218       {
03219         std::ostringstream oss;
03220         oss << value[i];
03221         vectorTable->setText(i,0,std::string(oss.str()).c_str());
03222       }
03223     return true;
03224       }
03225       //********************************************************************************************************************
03226       template<class T>
03227       void ModifyObject::storeQtTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, DataPtr< sofa::helper::vector< T > >* ff )
03228       {
03229       
03230       Q3Table* table=it_list_table->first;
03231       
03232     QString vec_value;
03233     vector< T > new_value;
03234     for (unsigned int i=0; i<ff->getValue().size(); i++)
03235       {
03236         vec_value = table->text(i,0);
03237         new_value.push_back( (T)atof(vec_value) );
03238       }    
03239     ff->setValue( new_value ); 
03240       }
03241       //********************************************************************************************************************
03242       //********************************************************************************************************************
03243       template< int N, class T>
03244       bool ModifyObject::createQtTable(Data< sofa::helper::vector< Vec<N,T> > > *ff, Q3GroupBox *box, Q3Table* vectorTable )
03245       {
03246     if (!vectorTable) 
03247       {                     
03248         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
03249 
03250         box->setColumns(1);
03251 
03252         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),N);
03253         else vectorTable = new Q3Table(ff->getValue().size(),N, box);
03254 
03255         list_Table.push_back(std::make_pair(vectorTable, ff));
03256         objectGUI.push_back(std::make_pair(ff,vectorTable));
03257 
03258         if (N>=0) {vectorTable->horizontalHeader()->setLabel(0,QString("X"));   vectorTable->setColumnStretchable(0,true);}
03259         if (N>=1) {vectorTable->horizontalHeader()->setLabel(1,QString("Y"));   vectorTable->setColumnStretchable(1,true);}
03260         if (N>=2) {vectorTable->horizontalHeader()->setLabel(2,QString("Z"));   vectorTable->setColumnStretchable(2,true);}
03261         
03262         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03263       }
03264 
03265     if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
03266     else      vectorTable->setNumRows(ff->getValue().size());
03267 
03268     sofa::helper::vector< Vec<N,T> > value = ff->getValue();
03269 
03270 
03271     for (unsigned int i=0; i<ff->getValue().size(); i++)
03272       {
03273         std::ostringstream oss[N];
03274         for (int j=0; j<N; j++)
03275           {                 
03276         oss[j] << value[i][j];
03277         vectorTable->setText(i,j,std::string(oss[j].str()).c_str());
03278           }
03279       }
03280     return true;
03281       }
03282       //*******************************************************************************************************************
03283       template< int N, class T>
03284       void ModifyObject::storeQtTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< Vec<N,T> > >* ff )
03285       {
03286       
03287       Q3Table* table=it_list_table->first;
03288 
03289     sofa::helper::vector< Vec<N,T> > new_value;
03290     for (unsigned int i=0; i<ff->getValue().size(); i++)
03291       {
03292         Vec<N,T> vec_value;
03293         for (int j=0; j<N; j++)
03294           {         
03295         vec_value[j] = (T) atof(table->text(i,j));          
03296           }
03297         new_value.push_back( vec_value );
03298       }
03299     ff->setValue( new_value );
03300       }
03301       //********************************************************************************************************************
03302       //********************************************************************************************************************
03303       template< int N, class T>
03304       bool ModifyObject::createQtTable(DataPtr< sofa::helper::vector< Vec<N,T> > > *ff, Q3GroupBox *box, Q3Table* vectorTable )
03305       {
03306     if (!vectorTable) 
03307       {                     
03308         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
03309 
03310         box->setColumns(1);
03311 
03312 
03313         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),N);
03314         else vectorTable = new Q3Table(ff->getValue().size(),N, box);
03315 
03316         list_Table.push_back(std::make_pair(vectorTable, ff));
03317         objectGUI.push_back(std::make_pair(ff,vectorTable));
03318 
03319         if (N>=0) {vectorTable->horizontalHeader()->setLabel(0,QString("X"));   vectorTable->setColumnStretchable(0,true);}
03320         if (N>=1) {vectorTable->horizontalHeader()->setLabel(1,QString("Y"));   vectorTable->setColumnStretchable(1,true);}
03321         if (N>=2) {vectorTable->horizontalHeader()->setLabel(2,QString("Z"));   vectorTable->setColumnStretchable(2,true);}
03322         
03323         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03324       }
03325     if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
03326     else      vectorTable->setNumRows(ff->getValue().size());
03327 
03328     sofa::helper::vector< Vec<N,T> > value = ff->getValue();
03329 
03330     for (unsigned int i=0; i<ff->getValue().size(); i++)
03331       {
03332         std::ostringstream oss[N];
03333         for (int j=0; j<N; j++)
03334           {                 
03335         oss[j] << value[i][j];
03336         vectorTable->setText(i,j,std::string(oss[j].str()).c_str());
03337           }
03338       }
03339     return true;
03340       }
03341       //********************************************************************************************************************
03342       template< int N, class T>
03343       void ModifyObject::storeQtTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, DataPtr< sofa::helper::vector< Vec<N,T> > >* ff )
03344       {
03345       
03346       Q3Table* table=it_list_table->first;
03347       
03348     sofa::helper::vector< Vec<N,T> > new_value;
03349     for (unsigned int i=0; i<ff->getValue().size(); i++)
03350       {
03351         Vec<N,T> vec_value;
03352         for (int j=0; j<N; j++)
03353           {         
03354         vec_value[j] = (T) atof(table->text(i,j));          
03355           }
03356          
03357         new_value.push_back( vec_value );
03358 
03359       }
03360     ff->setValue( new_value );
03361       }
03362       //********************************************************************************************************************
03363       //********************************************************************************************************************
03364       template< class T>
03365       bool ModifyObject::createQtTable(Data< sofa::component::topology::PointData< T > > *ff, Q3GroupBox *box, Q3Table* vectorTable )
03366       {
03367     if (!vectorTable)
03368       {
03369         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
03370 
03371         box->setColumns(1);
03372 
03373         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),1);
03374         else vectorTable = new Q3Table(ff->getValue().size(),1, box);
03375 
03376         list_Table.push_back(std::make_pair(vectorTable, ff));
03377         objectGUI.push_back(std::make_pair(ff,vectorTable));
03378         vectorTable->setColumnStretchable(0,true);
03379         
03380         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03381       }
03382     if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
03383     else      vectorTable->setNumRows(ff->getValue().size());
03384 
03385     vector< T > value = ff->getValue();
03386     /*
03387       if (vectorTable->numRows() < ff->getValue().size())
03388       {
03389       for (unsigned int i=0; 
03390       }
03391       else if (vectorTable->numRows() > ff->getValue().size())
03392       {
03393       
03394       }*/
03395     
03396     for (unsigned int i=0; i<ff->getValue().size(); i++)
03397       {
03398         std::ostringstream oss;
03399         oss << value[i];
03400         vectorTable->setText(i,0,std::string(oss.str()).c_str());
03401       }
03402     return true;
03403       }
03404       //********************************************************************************************************************
03405       template<class T>
03406       void ModifyObject::storeQtTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::component::topology::PointData< T >  >* ff )
03407       {
03408       
03409       Q3Table* table=it_list_table->first;
03410       
03411     QString vec_value;
03412     sofa::component::topology::PointData< T > new_value;
03413     for (unsigned int i=0; i<ff->getValue().size(); i++)
03414       {
03415         vec_value = table->text(i,0);
03416         new_value.push_back( (T)atof(vec_value) );
03417       }    
03418     ff->setValue( new_value ); 
03419       }
03420       //********************************************************************************************************************
03421     
03422     template< class T>
03423     bool ModifyObject::createMonitorQtTable(Data<typename sofa::component::misc::Monitor<T>::MonitorData >* ff, Q3GroupBox *box, Q3Table* vectorTable, Q3Table* vectorTable2, Q3Table* vectorTable3 )
03424     {
03425         //internal monitorData
03426         typename sofa::component::misc::Monitor<T>::MonitorData MonitorDataTemp = ff->getValue();
03427         //number of rows
03428         unsigned short int nbRowVels = 0, nbRowForces = 0, nbRowPos = 0;
03429             
03430         if (!vectorTable || !vectorTable2 || !vectorTable3) 
03431         {
03432             if (!MonitorDataTemp.sizeIdxPos() && !MonitorDataTemp.sizeIdxVels()
03433                 && !MonitorDataTemp.sizeIdxForces() && !EMPTY_FLAG )
03434                 return false;
03435             
03436             box->setColumns(2);
03437             new QLabel("", box);
03438             new QLabel("Positions", box);
03439             
03440             vectorTable = addResizableTable(box,MonitorDataTemp.sizeIdxPos(),4);
03441             new QLabel (" ", box);
03442                 
03443             vectorTable->setReadOnly(false);
03444             
03445             list_Table.push_back(std::make_pair(vectorTable, ff));
03446             objectGUI.push_back(std::make_pair(ff,vectorTable));
03447 
03448             vectorTable->horizontalHeader()->setLabel(0,QString("particle Indices"));
03449             vectorTable->setColumnStretchable(0,true);
03450             vectorTable->horizontalHeader()->setLabel(1,QString("X"));      vectorTable->setColumnStretchable(1,true);
03451             vectorTable->horizontalHeader()->setLabel(2,QString("Y"));      vectorTable->setColumnStretchable(2,true);
03452             vectorTable->horizontalHeader()->setLabel(3,QString("Z"));      vectorTable->setColumnStretchable(3,true);
03453                 
03454             connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03455                     
03456             new QLabel("Velocities", box);
03457             
03458             vectorTable2 = addResizableTable(box,MonitorDataTemp.sizeIdxVels(),4);
03459             new QLabel (" ", box);
03460             vectorTable2->setReadOnly(false);
03461             
03462             list_Table.push_back(std::make_pair(vectorTable2, ff));
03463             objectGUI.push_back(std::make_pair(ff,vectorTable2));
03464 
03465             vectorTable2->horizontalHeader()->setLabel(0,QString("particle Indices"));
03466             vectorTable2->setColumnStretchable(0,true);
03467             vectorTable2->horizontalHeader()->setLabel(1,QString("X"));
03468             vectorTable2->setColumnStretchable(1,true);
03469             vectorTable2->horizontalHeader()->setLabel(2,QString("Y"));
03470             vectorTable2->setColumnStretchable(2,true);
03471             vectorTable2->horizontalHeader()->setLabel(3,QString("Z"));
03472             vectorTable2->setColumnStretchable(3,true);
03473                 
03474             connect( vectorTable2, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03475                 
03476             new QLabel("Forces", box);
03477             
03478             vectorTable3 = addResizableTable(box,MonitorDataTemp.sizeIdxForces(),4);
03479             new QLabel (" ", box);
03480             vectorTable3->setReadOnly(false);
03481             
03482             list_Table.push_back(std::make_pair(vectorTable3, ff));
03483             objectGUI.push_back(std::make_pair(ff,vectorTable3));
03484             
03485             vectorTable3->horizontalHeader()->setLabel(0,QString("particle Indices"));
03486             vectorTable3->setColumnStretchable(0,true);
03487             vectorTable3->horizontalHeader()->setLabel(1,QString("X"));
03488             vectorTable3->setColumnStretchable(1,true);
03489             vectorTable3->horizontalHeader()->setLabel(2,QString("Y"));
03490             vectorTable3->setColumnStretchable(2,true);
03491             vectorTable3->horizontalHeader()->setLabel(3,QString("Z"));
03492             vectorTable3->setColumnStretchable(3,true);
03493                 
03494             connect( vectorTable3, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03495         
03496         } //fin if (!vectorTable)
03497         
03498         //number of rows for positions
03499         if (MonitorDataTemp.getSizeVecVels())
03500         {
03501             if (setResize.find(vectorTable) != setResize.end())
03502             {
03503                 sofa::helper::vector < int > NewIndPos;
03504                 NewIndPos = MonitorDataTemp.getIndPos();
03505                 NewIndPos.resize(vectorTable->numRows(), 0);
03506                 nbRowPos = NewIndPos.size();
03507                 MonitorDataTemp.setIndPos (NewIndPos);
03508             }
03509             else
03510             {
03511                 nbRowPos = MonitorDataTemp.sizeIdxPos();
03512                 vectorTable->setNumRows(nbRowPos);
03513             }
03514         }
03515         else
03516         {
03517             vectorTable->setNumRows(nbRowPos);
03518         }
03519         
03520         //number of rows for velocities
03521         if (MonitorDataTemp.getSizeVecVels())
03522         {
03523             if (setResize.find(vectorTable2) != setResize.end())
03524             {
03525                 sofa::helper::vector < int > NewIndVels;
03526                 NewIndVels = MonitorDataTemp.getIndVels();
03527                 NewIndVels.resize(vectorTable2->numRows(), 0);
03528                 nbRowVels = NewIndVels.size();
03529                 MonitorDataTemp.setIndVels (NewIndVels);
03530             }
03531             else
03532             {
03533                 nbRowVels = MonitorDataTemp.sizeIdxVels();
03534                 vectorTable2->setNumRows(nbRowVels);
03535             }
03536         }
03537         else
03538         {
03539             vectorTable2->setNumRows(nbRowVels);
03540         }
03541         
03542         //number of rows for forces
03543         if (MonitorDataTemp.getSizeVecForces())
03544         {
03545             if (setResize.find(vectorTable3) != setResize.end())
03546             {
03547                 sofa::helper::vector < int > NewIndForces;
03548                 NewIndForces = MonitorDataTemp.getIndForces();
03549                 NewIndForces.resize(vectorTable3->numRows(), 0);
03550                 nbRowForces = NewIndForces.size();
03551                 MonitorDataTemp.setIndForces (NewIndForces);
03552             }
03553             else
03554             {
03555                 nbRowForces = MonitorDataTemp.sizeIdxForces();
03556                 vectorTable3->setNumRows(nbRowForces);
03557             }
03558         }
03559         else
03560         {
03561             vectorTable3->setNumRows(nbRowForces);
03562         }
03563         
03564             
03565         for (unsigned int i=0; i<3; i++)
03566         {
03567             std::ostringstream *oss = new std::ostringstream[nbRowPos];
03568             for (unsigned int j=0; j<nbRowPos; j++)
03569             {
03570                 oss[j] << (MonitorDataTemp.getPos(j))[i];
03571                 vectorTable->setText(j,i+1,std::string(oss[j].str()).c_str());
03572             }
03573                 
03574             std::ostringstream * oss2 = new std::ostringstream[nbRowVels];
03575             for (unsigned int j=0; j<nbRowVels; j++)
03576             {
03577                 oss2[j] << (MonitorDataTemp.getVel(j))[i];
03578                 vectorTable2->setText(j,i+1,std::string(oss2[j].str()).c_str());
03579             }
03580                 
03581             std::ostringstream * oss3 = new std::ostringstream[nbRowForces];
03582             for (unsigned int j=0; j<nbRowForces; j++)
03583             {
03584                 oss3[j] << (MonitorDataTemp.getForce(j))[i];
03585                 vectorTable3->setText(j,i+1,std::string(oss3[j].str()).c_str());
03586             }
03587             delete [] oss;
03588             delete [] oss2;
03589             delete [] oss3;
03590         }
03591             //vectorTable1
03592         std::ostringstream  * oss = new std::ostringstream[nbRowPos];
03593         for (unsigned int j=0; j<nbRowPos; j++)
03594         {
03595             oss[j] << MonitorDataTemp.getIndPos()[j];
03596             vectorTable->setText(j,0,std::string(oss[j].str()).c_str());
03597         }
03598             //vectorTable2
03599         std::ostringstream * oss2 = new std::ostringstream[nbRowVels];
03600         for (unsigned int j=0; j<nbRowVels; j++)
03601         {
03602             oss2[j] << MonitorDataTemp.getIndVels()[j];
03603             vectorTable2->setText(j,0,std::string(oss2[j].str()).c_str());
03604         }
03605             //vectorTable3
03606         std::ostringstream * oss3 = new std::ostringstream[nbRowForces];
03607         for (unsigned int j=0; j<nbRowForces; j++)
03608         {
03609             oss3[j] << MonitorDataTemp.getIndForces()[j];
03610             vectorTable3->setText(j,0,std::string(oss3[j].str()).c_str());
03611         }
03612 
03613         delete [] oss;
03614         delete [] oss2;
03615         delete [] oss3;
03616             
03617         counterWidget+=3;
03618         ff->setValue (MonitorDataTemp);
03619         return true;
03620     }
03621     
03622     //********************************************************************************************************************
03623     template<class T>
03624     void ModifyObject::storeMonitorQtTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data<typename sofa::component::misc::Monitor<T>::MonitorData >* ff )
03625     {
03626         Q3Table* table = it_list_table->first;
03627         //internal monitorData
03628         typename sofa::component::misc::Monitor<T>::MonitorData NewMonitorData = ff->getValue();
03629         
03630 
03631         //Qtable positions
03632         if (NewMonitorData.getSizeVecPos())
03633         {
03634             int valueBox;
03635             sofa::helper::vector < int > values = NewMonitorData.getIndPos();
03636             for (int i=0; i < table -> numRows(); i++)
03637             {
03638                 valueBox = (int)atof(table->text(i,0));
03639                 if(valueBox >= 0 && valueBox <= (int)(NewMonitorData.getSizeVecPos() - 1))
03640                     values[i] = valueBox;
03641             }
03642             
03643             NewMonitorData.setIndPos(values);
03644         }
03645         it_list_table++;
03646         table = it_list_table->first;
03647         
03648         
03649         //Qtable velocities
03650 
03651         if (NewMonitorData.getSizeVecVels())
03652         {
03653             int valueBox;
03654             sofa::helper::vector < int > values = NewMonitorData.getIndVels();
03655             for (int i=0; i < table -> numRows(); i++)
03656             {
03657                 valueBox = (int)atof(table->text(i,0));
03658                 if(valueBox >= 0 && valueBox <= (int)(NewMonitorData.getSizeVecVels() - 1))
03659                     values[i] = valueBox;
03660             }
03661             
03662             NewMonitorData.setIndVels(values);
03663         }
03664         it_list_table++;
03665         table=it_list_table->first;
03666 
03667         
03668         //Qtable forces
03669 
03670         if (NewMonitorData.getSizeVecForces())
03671         {
03672             int valueBox;
03673             sofa::helper::vector < int > values = NewMonitorData.getIndForces();
03674             
03675             for (int i=0; i < table -> numRows(); i++)
03676             {
03677                 valueBox = (int)atof(table->text(i,0));
03678                 if(valueBox >= 0 && valueBox <= (int)(NewMonitorData.getSizeVecForces() - 1))
03679                     values[i] = valueBox;
03680             }
03681 
03682             NewMonitorData.setIndForces(values);
03683         }
03684 
03685         ff->setValue(NewMonitorData);
03686     }
03687       //********************************************************************************************************************
03688     
03689       template< int N, class T>
03690       bool ModifyObject::createQtTable(DataPtr< sofa::helper::vector< RigidCoord<N,T> > > *ff, Q3GroupBox *box, Q3Table* vectorTable, Q3Table* vectorTable2 )
03691       {
03692         if (!vectorTable) 
03693           {                     
03694         if (ff->getValue().size() == 0 && !EMPTY_FLAG)  return false;
03695         box->setColumns(1);
03696         if (RESIZABLE_FLAG) new QLabel("", box);
03697         new QLabel("Center", box);
03698 
03699 
03700         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),N);
03701         else vectorTable = new Q3Table(ff->getValue().size(),N, box);
03702 
03703         vectorTable->setReadOnly(false);        
03704         list_Table.push_back(std::make_pair(vectorTable, ff));
03705 
03706         vectorTable->horizontalHeader()->setLabel(0,QString("X"));      vectorTable->setColumnStretchable(0,true);
03707         if (N>1){ vectorTable->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable->setColumnStretchable(1,true);}
03708         if (N>2){ vectorTable->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable->setColumnStretchable(2,true);}
03709         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03710 
03711         if (RESIZABLE_FLAG)new QLabel("", box);
03712         new QLabel("Orientation", box);
03713         if (RESIZABLE_FLAG)new QLabel("", box);
03714 
03715         if (N==2) 
03716           {
03717             vectorTable2 = new Q3Table(ff->getValue().size(),1, box);
03718 
03719             vectorTable2->horizontalHeader()->setLabel(0,QString("angle"));     vectorTable2->setColumnStretchable(0,true);
03720           }
03721         else
03722           {
03723             vectorTable2 = new Q3Table(ff->getValue().size(),4, box);
03724             vectorTable2->horizontalHeader()->setLabel(0,QString("X"));      vectorTable2->setColumnStretchable(0,true);
03725             vectorTable2->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable2->setColumnStretchable(1,true);
03726             vectorTable2->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable2->setColumnStretchable(2,true);
03727             vectorTable2->horizontalHeader()->setLabel(3,QString("W"));      vectorTable2->setColumnStretchable(3,true);
03728           }
03729                 
03730         list_Table.push_back(std::make_pair(vectorTable2, ff));
03731 
03732         connect( vectorTable2, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03733 
03734           }
03735 
03736 
03737         if (setResize.find(vectorTable) != setResize.end()) 
03738         ff->beginEdit()->resize(vectorTable->numRows());
03739         else
03740         vectorTable->setNumRows(ff->getValue().size());
03741 
03742         vectorTable2->setNumRows(vectorTable->numRows());
03743 
03744         vector< RigidCoord<N,T> > value = ff->getValue();
03745 
03746 
03747         for (unsigned int i=0; i<ff->getValue().size(); i++)
03748           {
03749         std::ostringstream oss[N];
03750 
03751         for (int j=0; j<N; j++)
03752           {                 
03753             oss[j] << value[i].getCenter()[j];
03754             vectorTable->setText(i,j,std::string(oss[j].str()).c_str());
03755           } 
03756 
03757 
03758         std::ostringstream oss_o;
03759         oss_o << value[i].getOrientation();
03760         std::istringstream oss_i;
03761         oss_i.str( oss_o.str() );
03762         T Tvalue;
03763         int count = 0;
03764         while (oss_i >> Tvalue)    vectorTable2->setText(i,count++,QString::number(Tvalue));
03765           }    
03766         counterWidget+=2;
03767         return true;
03768       }
03769       //********************************************************************************************************************
03770       template< int N, class T>
03771       bool ModifyObject::createQtTable(Data< sofa::helper::vector< RigidCoord<N,T> > > *ff, Q3GroupBox *box, Q3Table* vectorTable, Q3Table* vectorTable2 )
03772       {
03773         if (!vectorTable) 
03774           {                     
03775         if (ff->getValue().size() == 0 && !EMPTY_FLAG)  return false;
03776         box->setColumns(1);
03777 
03778         if (RESIZABLE_FLAG) new QLabel("", box);
03779         new QLabel("Center", box);
03780 
03781 
03782         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),N);
03783         else vectorTable = new Q3Table(ff->getValue().size(),N, box);
03784 
03785         vectorTable->setReadOnly(false);        
03786         list_Table.push_back(std::make_pair(vectorTable, ff));
03787         vectorTable->horizontalHeader()->setLabel(0,QString("X"));      vectorTable->setColumnStretchable(0,true);
03788         if (N>1){ vectorTable->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable->setColumnStretchable(1,true);}
03789         if (N>2){ vectorTable->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable->setColumnStretchable(2,true);}
03790         
03791         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03792 
03793         if (RESIZABLE_FLAG)new QLabel("", box);
03794         new QLabel("Orientation", box);
03795         if (RESIZABLE_FLAG)new QLabel("", box);
03796         
03797         if (N==2) 
03798           {
03799             vectorTable2 = new Q3Table(ff->getValue().size(),1, box); 
03800             vectorTable2->horizontalHeader()->setLabel(0,QString("angle"));     vectorTable2->setColumnStretchable(0,true);
03801           }
03802         else
03803           {
03804             vectorTable2 = new Q3Table(ff->getValue().size(),4, box);
03805             vectorTable2->horizontalHeader()->setLabel(0,QString("X"));      vectorTable2->setColumnStretchable(0,true);
03806             vectorTable2->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable2->setColumnStretchable(1,true);
03807             vectorTable2->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable2->setColumnStretchable(2,true);
03808             vectorTable2->horizontalHeader()->setLabel(3,QString("W"));      vectorTable2->setColumnStretchable(3,true);
03809           }
03810                 
03811         list_Table.push_back(std::make_pair(vectorTable2, ff));
03812 
03813         connect( vectorTable2, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03814 
03815           }
03816 
03817         if (setResize.find(vectorTable) != setResize.end()) 
03818         ff->beginEdit()->resize(vectorTable->numRows());
03819         else
03820         vectorTable->setNumRows(ff->getValue().size());
03821 
03822         vectorTable2->setNumRows(vectorTable->numRows());
03823 
03824         vector< RigidCoord<N,T> > value = ff->getValue();
03825 
03826 
03827         for (unsigned int i=0; i<ff->getValue().size(); i++)
03828           {
03829         std::ostringstream oss[N];
03830 
03831         for (int j=0; j<N; j++)
03832           {                 
03833             oss[j] << value[i].getCenter()[j];
03834             vectorTable->setText(i,j,std::string(oss[j].str()).c_str());
03835           } 
03836 
03837 
03838         std::ostringstream oss_o;
03839         oss_o << value[i].getOrientation();
03840         std::istringstream oss_i;
03841         oss_i.str( oss_o.str() );
03842         T Tvalue;
03843         int count = 0;
03844         while (oss_i >> Tvalue)    vectorTable2->setText(i,count++,QString::number(Tvalue));
03845           }
03846         counterWidget+=2;
03847         return true;
03848       }
03849     //********************************************************************************************************************
03850       template< int N, class T>
03851       bool ModifyObject::createQtTable(Data< sofa::helper::vector< RigidDeriv<N,T> > > *ff, Q3GroupBox *box, Q3Table* vectorTable, Q3Table* vectorTable2 )
03852       {
03853         if (!vectorTable) 
03854           {                     
03855         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
03856         box->setColumns(1);
03857 
03858 
03859         if (RESIZABLE_FLAG) new QLabel("", box);
03860         new QLabel("Center", box);
03861 
03862 
03863         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),N);
03864         else vectorTable = new Q3Table(ff->getValue().size(),N, box);
03865 
03866         vectorTable->setReadOnly(false);
03867                 
03868         list_Table.push_back(std::make_pair(vectorTable, ff));
03869         vectorTable->horizontalHeader()->setLabel(0,QString("X"));  vectorTable->setColumnStretchable(0,true);
03870         if (N>1){ vectorTable->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable->setColumnStretchable(1,true);}
03871         if (N>2){ vectorTable->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable->setColumnStretchable(2,true);}
03872         
03873         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03874 
03875         if (RESIZABLE_FLAG)new QLabel("", box);
03876         new QLabel("Orientation", box);
03877         if (RESIZABLE_FLAG)new QLabel("", box);
03878 
03879         if (N==2) 
03880           {
03881             vectorTable2 = new Q3Table(ff->getValue().size(),1, box);
03882             vectorTable2->horizontalHeader()->setLabel(0,QString("angle"));  vectorTable2->setColumnStretchable(0,true);
03883           }
03884         else
03885           {
03886             vectorTable2 = new Q3Table(ff->getValue().size(),3, box);
03887             vectorTable2->horizontalHeader()->setLabel(0,QString("X"));  vectorTable2->setColumnStretchable(0,true);
03888             vectorTable2->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable2->setColumnStretchable(1,true);
03889             vectorTable2->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable2->setColumnStretchable(2,true);
03890           }
03891     
03892         
03893         list_Table.push_back(std::make_pair(vectorTable2, ff)); 
03894         connect( vectorTable2, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03895 
03896           }
03897 
03898 
03899         if (setResize.find(vectorTable) != setResize.end()) 
03900         ff->beginEdit()->resize(vectorTable->numRows());
03901         else
03902         vectorTable->setNumRows(ff->getValue().size());
03903 
03904         vectorTable2->setNumRows(vectorTable->numRows());
03905 
03906         vector< RigidDeriv<N,T> > value = ff->getValue();
03907 
03908 
03909         for (unsigned int i=0; i<ff->getValue().size(); i++)
03910           {
03911         std::ostringstream oss[N];
03912 
03913         for (int j=0; j<N; j++)
03914           {                 
03915             oss[j] << value[i].getVCenter()[j];
03916             vectorTable->setText(i,j,std::string(oss[j].str()).c_str());
03917           } 
03918 
03919         std::ostringstream oss_o;
03920         oss_o << value[i].getVOrientation();
03921         std::istringstream oss_i;
03922         oss_i.str( oss_o.str() );
03923         T Tvalue;
03924         int count = 0;
03925         while (oss_i >> Tvalue)    vectorTable2->setText(i,count++,QString::number(Tvalue));
03926           }
03927         counterWidget+=2;
03928         return true;
03929     }
03930     //********************************************************************************************************************
03931       template< int N, class T>
03932       bool ModifyObject::createQtTable(DataPtr< sofa::helper::vector< RigidDeriv<N,T> > > *ff, Q3GroupBox *box, Q3Table* vectorTable, Q3Table* vectorTable2 )
03933       {
03934         if (!vectorTable) 
03935           {                     
03936         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
03937         box->setColumns(1);
03938 
03939 
03940         if (RESIZABLE_FLAG) new QLabel("", box);
03941         new QLabel("Center", box);
03942 
03943 
03944         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),N);
03945         else vectorTable = new Q3Table(ff->getValue().size(),N, box);
03946 
03947         vectorTable->setReadOnly(false);
03948                 
03949         list_Table.push_back(std::make_pair(vectorTable, ff));
03950         vectorTable->horizontalHeader()->setLabel(0,QString("X"));  vectorTable->setColumnStretchable(0,true);
03951         if (N>1){ vectorTable->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable->setColumnStretchable(1,true);}
03952         if (N>2){ vectorTable->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable->setColumnStretchable(2,true);}
03953         
03954         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03955 
03956         if (RESIZABLE_FLAG)new QLabel("", box);
03957         new QLabel("Orientation", box);
03958         if (RESIZABLE_FLAG)new QLabel("", box);
03959 
03960         if (N==2) 
03961           {
03962             vectorTable2 = new Q3Table(ff->getValue().size(),1, box);
03963             vectorTable2->horizontalHeader()->setLabel(0,QString("angle"));  vectorTable2->setColumnStretchable(0,true);
03964           }
03965         else
03966           {
03967             vectorTable2 = new Q3Table(ff->getValue().size(),3, box);
03968             vectorTable2->horizontalHeader()->setLabel(0,QString("X"));  vectorTable2->setColumnStretchable(0,true);
03969             vectorTable2->horizontalHeader()->setLabel(1,QString("Y"));      vectorTable2->setColumnStretchable(1,true);
03970             vectorTable2->horizontalHeader()->setLabel(2,QString("Z"));      vectorTable2->setColumnStretchable(2,true);
03971           }
03972     
03973         
03974         list_Table.push_back(std::make_pair(vectorTable2, ff)); 
03975         connect( vectorTable2, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
03976 
03977           }
03978 
03979         if (setResize.find(vectorTable) != setResize.end()) 
03980         ff->beginEdit()->resize(vectorTable->numRows());
03981         else
03982         vectorTable->setNumRows(ff->getValue().size());
03983 
03984         vectorTable2->setNumRows(vectorTable->numRows());
03985 
03986         vector< RigidDeriv<N,T> > value = ff->getValue();
03987 
03988 
03989         for (unsigned int i=0; i<ff->getValue().size(); i++)
03990           {
03991         std::ostringstream oss[N];
03992 
03993         for (int j=0; j<N; j++)
03994           {                 
03995             oss[j] << value[i].getVCenter()[j];
03996             vectorTable->setText(i,j,std::string(oss[j].str()).c_str());
03997           } 
03998 
03999         std::ostringstream oss_o;
04000         oss_o << value[i].getVOrientation();
04001         std::istringstream oss_i;
04002         oss_i.str( oss_o.str() );
04003         T Tvalue;
04004         int count = 0;
04005         while (oss_i >> Tvalue)    vectorTable2->setText(i,count++,QString::number(Tvalue));
04006           }
04007         counterWidget+=2;
04008         return true;
04009     }
04010     //********************************************************************************************************************
04011       template< class T>
04012     void ModifyObject::storeQtRigid3Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< RigidCoord<3,T> > >* ff )
04013       {   
04014         Q3Table* table = it_list_table->first;
04015            
04016         sofa::helper::vector< Vec<3,T> > new_valuePosition;
04017         for (unsigned int i=0; i<ff->getValue().size(); i++)
04018           {
04019             Vec<3,T> vec_value;
04020             for (int j=0; j<3; j++)
04021               {         
04022             vec_value[j] = (T) atof(table->text(i,j));          
04023               }
04024             new_valuePosition.push_back( vec_value );
04025           }
04026 
04027         it_list_table++;
04028         table = it_list_table->first;
04029 
04030         sofa::helper::vector< RigidCoord<3,T> > new_value;
04031         sofa::helper::vector<sofa::helper::Quater<T> > new_valueOrientation;
04032         for (unsigned int i=0; i<ff->getValue().size(); i++)
04033           {
04034             Quater<T> vec_value;
04035             for (unsigned int j=0;j<4;++j)
04036               {
04037                 vec_value[j] = (T) atof(table->text(i,j));  
04038               }
04039             new_valueOrientation.push_back( vec_value );
04040           }
04041         for (unsigned int i=0;i<ff->getValue().size();i++)
04042           {
04043             new_value.push_back(RigidCoord<3,T>(new_valuePosition[i], new_valueOrientation[i]));
04044           }
04045         ff->setValue( new_value );              
04046       }
04047 
04048 
04049     //********************************************************************************************************************
04050       template< class T>
04051     void ModifyObject::storeQtRigid2Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< RigidCoord<2,T> > >* ff )
04052       {   
04053         Q3Table* table = it_list_table->first;
04054            
04055         sofa::helper::vector< Vec<2,T> > new_valuePosition;
04056         for (unsigned int i=0; i<ff->getValue().size(); i++)
04057           {
04058             Vec<2,T> vec_value;
04059             for (int j=0; j<2; j++)
04060               {         
04061             vec_value[j] = (T) atof(table->text(i,j));          
04062               }
04063             new_valuePosition.push_back( vec_value );
04064           }
04065 
04066         it_list_table++;
04067         table = it_list_table->first;
04068 
04069         sofa::helper::vector< RigidCoord<2,T> > new_value;
04070 
04071         sofa::helper::vector< T > new_valueOrientation;
04072         for (unsigned int i=0; i<ff->getValue().size(); i++)
04073           {
04074             T vec_value;
04075             vec_value = (T) atof(table->text(i,0)); 
04076             new_valueOrientation.push_back( vec_value );
04077           }
04078         for (unsigned int i=0;i<ff->getValue().size();i++)
04079           {
04080             new_value.push_back(RigidCoord<2,T>(new_valuePosition[i], new_valueOrientation[i]));
04081           }
04082         ff->setValue( new_value );                      
04083       }
04084     //********************************************************************************************************************
04085  
04086       template< class T>
04087     void ModifyObject::storeQtRigid3Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, DataPtr< sofa::helper::vector< RigidCoord<3,T> > >* ff )
04088       {   
04089         Q3Table* table = it_list_table->first;
04090            
04091         sofa::helper::vector< Vec<3,T> > new_valuePosition;
04092         for (unsigned int i=0; i<ff->getValue().size(); i++)
04093           {
04094             Vec<3,T> vec_value;
04095             for (int j=0; j<3; j++)
04096               {         
04097             vec_value[j] = (T) atof(table->text(i,j));          
04098               }
04099             new_valuePosition.push_back( vec_value );
04100           }
04101 
04102         it_list_table++;
04103         table = it_list_table->first;
04104 
04105         sofa::helper::vector< RigidCoord<3,T> > new_value;
04106         sofa::helper::vector<sofa::helper::Quater<T> > new_valueOrientation;
04107         for (unsigned int i=0; i<ff->getValue().size(); i++)
04108           {
04109             Quater<T> vec_value;
04110             for (unsigned int j=0;j<4;++j)
04111               {
04112                 vec_value[j] = (T) atof(table->text(i,j));  
04113               }
04114             new_valueOrientation.push_back( vec_value );
04115           }
04116         for (unsigned int i=0;i<ff->getValue().size();i++)
04117           {
04118             new_value.push_back(RigidCoord<3,T>(new_valuePosition[i], new_valueOrientation[i]));
04119           }
04120         ff->setValue( new_value );              
04121       }
04122 
04123 
04124     //********************************************************************************************************************
04125       template< class T>
04126     void ModifyObject::storeQtRigid2Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, DataPtr< sofa::helper::vector< RigidCoord<2,T> > >* ff )
04127       {   
04128         Q3Table* table = it_list_table->first;
04129            
04130         sofa::helper::vector< Vec<2,T> > new_valuePosition;
04131         for (unsigned int i=0; i<ff->getValue().size(); i++)
04132           {
04133             Vec<2,T> vec_value;
04134             for (int j=0; j<2; j++)
04135               {         
04136             vec_value[j] = (T) atof(table->text(i,j));          
04137               }
04138             new_valuePosition.push_back( vec_value );
04139           }
04140 
04141         it_list_table++;
04142         table = it_list_table->first;
04143 
04144         sofa::helper::vector< RigidCoord<2,T> > new_value;
04145 
04146         sofa::helper::vector< T > new_valueOrientation;
04147         for (unsigned int i=0; i<ff->getValue().size(); i++)
04148           {
04149             T vec_value;
04150             vec_value = (T) atof(table->text(i,0)); 
04151             new_valueOrientation.push_back( vec_value );
04152           }
04153         for (unsigned int i=0;i<ff->getValue().size();i++)
04154           {
04155             new_value.push_back(RigidCoord<2,T>(new_valuePosition[i], new_valueOrientation[i]));
04156           }
04157         ff->setValue( new_value );                      
04158       }
04159 
04160       template< class T>
04161     void ModifyObject::storeQtRigid3Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< RigidDeriv<3,T> > >* ff )
04162       {   
04163         Q3Table* table = it_list_table->first;
04164            
04165         sofa::helper::vector< Vec<3,T> > new_valuePosition;
04166         for (unsigned int i=0; i<ff->getValue().size(); i++)
04167           {
04168             Vec<3,T> vec_value;
04169             for (int j=0; j<3; j++)
04170               {         
04171             vec_value[j] = (T) atof(table->text(i,j));          
04172               }
04173             new_valuePosition.push_back( vec_value );
04174           }
04175 
04176         it_list_table++;
04177         table = it_list_table->first;
04178 
04179         sofa::helper::vector< RigidDeriv<3,T> > new_value;
04180         sofa::helper::vector<Vec<3,T> > new_valueOrientation;
04181         for (unsigned int i=0; i<ff->getValue().size(); i++)
04182           {
04183             Vec<3,T> vec_value;
04184             for (unsigned int j=0;j<3;++j)
04185               {
04186                 vec_value[j] = (T) atof(table->text(i,j));  
04187               }
04188             new_valueOrientation.push_back( vec_value );
04189           }
04190         for (unsigned int i=0;i<ff->getValue().size();i++)
04191           {
04192             new_value.push_back(RigidDeriv<3,T>(new_valuePosition[i], new_valueOrientation[i]));
04193           }
04194         ff->setValue( new_value );              
04195       }
04196 
04197 
04198     //********************************************************************************************************************
04199       template< class T>
04200     void ModifyObject::storeQtRigid2Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< RigidDeriv<2,T> > >* ff )
04201       {   
04202         Q3Table* table = it_list_table->first;
04203            
04204         sofa::helper::vector< Vec<2,T> > new_valuePosition;
04205         for (unsigned int i=0; i<ff->getValue().size(); i++)
04206           {
04207             Vec<2,T> vec_value;
04208             for (int j=0; j<2; j++)
04209               {         
04210             vec_value[j] = (T) atof(table->text(i,j));          
04211               }
04212             new_valuePosition.push_back( vec_value );
04213           }
04214 
04215         it_list_table++;
04216         table = it_list_table->first;
04217 
04218         sofa::helper::vector< RigidDeriv<2,T> > new_value;
04219 
04220         sofa::helper::vector< T > new_valueOrientation;
04221         for (unsigned int i=0; i<ff->getValue().size(); i++)
04222           {
04223             T vec_value;
04224             vec_value = (T) atof(table->text(i,0)); 
04225             new_valueOrientation.push_back( vec_value );
04226           }
04227         for (unsigned int i=0;i<ff->getValue().size();i++)
04228           {
04229             new_value.push_back(RigidDeriv<2,T>(new_valuePosition[i], new_valueOrientation[i]));
04230           }
04231         ff->setValue( new_value );                      
04232       }
04233 
04234       template< class T>
04235     void ModifyObject::storeQtRigid3Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, DataPtr< sofa::helper::vector< RigidDeriv<3,T> > >* ff )
04236       {   
04237         Q3Table* table = it_list_table->first;
04238            
04239         sofa::helper::vector< Vec<3,T> > new_valuePosition;
04240         for (unsigned int i=0; i<ff->getValue().size(); i++)
04241           {
04242             Vec<3,T> vec_value;
04243             for (int j=0; j<3; j++)
04244               {         
04245             vec_value[j] = (T) atof(table->text(i,j));          
04246               }
04247             new_valuePosition.push_back( vec_value );
04248           }
04249 
04250         it_list_table++;
04251         table = it_list_table->first;
04252 
04253         sofa::helper::vector< RigidDeriv<3,T> > new_value;
04254         sofa::helper::vector<Vec<3,T> > new_valueOrientation;
04255         for (unsigned int i=0; i<ff->getValue().size(); i++)
04256           {
04257             Vec<3,T> vec_value;
04258             for (unsigned int j=0;j<3;++j)
04259               {
04260                 vec_value[j] = (T) atof(table->text(i,j));  
04261               }
04262             new_valueOrientation.push_back( vec_value );
04263           }
04264         for (unsigned int i=0;i<ff->getValue().size();i++)
04265           {
04266             new_value.push_back(RigidDeriv<3,T>(new_valuePosition[i], new_valueOrientation[i]));
04267           }
04268         ff->setValue( new_value );              
04269       }
04270 
04271 
04272     //********************************************************************************************************************
04273       template< class T>
04274     void ModifyObject::storeQtRigid2Table( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, DataPtr< sofa::helper::vector< RigidDeriv<2,T> > >* ff )
04275       {   
04276         Q3Table* table = it_list_table->first;
04277            
04278         sofa::helper::vector< Vec<2,T> > new_valuePosition;
04279         for (unsigned int i=0; i<ff->getValue().size(); i++)
04280           {
04281             Vec<2,T> vec_value;
04282             for (int j=0; j<2; j++)
04283               {         
04284             vec_value[j] = (T) atof(table->text(i,j));          
04285               }
04286             new_valuePosition.push_back( vec_value );
04287           }
04288 
04289         it_list_table++;
04290         table = it_list_table->first;
04291 
04292         sofa::helper::vector< RigidDeriv<2,T> > new_value;
04293 
04294         sofa::helper::vector< T > new_valueOrientation;
04295         for (unsigned int i=0; i<ff->getValue().size(); i++)
04296           {
04297             T vec_value;
04298             vec_value = (T) atof(table->text(i,0)); 
04299             new_valueOrientation.push_back( vec_value );
04300           }
04301         for (unsigned int i=0;i<ff->getValue().size();i++)
04302           {
04303             new_value.push_back(RigidDeriv<2,T>(new_valuePosition[i], new_valueOrientation[i]));
04304           }
04305         ff->setValue( new_value );                      
04306       }
04307 
04308 
04309 
04310 #ifndef WIN32
04311     //********************************************************************************************************************
04312       template< int N, class T>
04313       bool ModifyObject::createQtSpringTable(Data< sofa::helper::vector< typename sofa::component::forcefield::SpringForceField< StdVectorTypes<Vec<N,T>,Vec<N,T>,T> >::Spring > >   *ff, Q3GroupBox *box, Q3Table* vectorTable )
04314       {
04315         if (!vectorTable)
04316           {
04317         if (ff->getValue().size() == 0 && !EMPTY_FLAG)  return false;
04318         box->setColumns(1);
04319 
04320         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),5);
04321         else vectorTable = new Q3Table(ff->getValue().size(),5, box);
04322         
04323         list_Table.push_back(std::make_pair(vectorTable, ff));
04324         vectorTable->horizontalHeader()->setLabel(0,QString("Index 1")); vectorTable->setColumnStretchable(0,true);
04325         vectorTable->horizontalHeader()->setLabel(1,QString("Index 2")); vectorTable->setColumnStretchable(1,true);
04326         vectorTable->horizontalHeader()->setLabel(2,QString("Ks : stiffness")); vectorTable->setColumnStretchable(2,true);
04327         vectorTable->horizontalHeader()->setLabel(3,QString("Kd : damping")); vectorTable->setColumnStretchable(3,true);
04328         vectorTable->horizontalHeader()->setLabel(4,QString("Rest Length")); vectorTable->setColumnStretchable(4,true);
04329         
04330         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
04331           }
04332 
04333         if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
04334         else      vectorTable->setNumRows(ff->getValue().size());
04335 
04336         sofa::helper::vector<typename  sofa::component::forcefield::SpringForceField< StdVectorTypes<Vec<N,T>,Vec<N,T>,T> >::Spring > value = ff->getValue();
04337 
04338         for (unsigned int i=0; i<ff->getValue().size(); i++)
04339           {
04340         std::ostringstream oss[5];
04341         oss[0] << value[i].m1;      vectorTable->setText(i,0,std::string(oss[0].str()).c_str());
04342         oss[1] << value[i].m2;      vectorTable->setText(i,1,std::string(oss[1].str()).c_str());
04343         oss[2] << value[i].ks;      vectorTable->setText(i,2,std::string(oss[2].str()).c_str());
04344         oss[3] << value[i].kd;      vectorTable->setText(i,3,std::string(oss[3].str()).c_str());
04345         oss[4] << value[i].initpos; vectorTable->setText(i,4,std::string(oss[4].str()).c_str());
04346           }
04347         return true;
04348       }
04349 
04350     //********************************************************************************************************************
04351     template< int N, class T>
04352       void ModifyObject::storeQtSpringTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data<  sofa::helper::vector< typename sofa::component::forcefield::SpringForceField< StdVectorTypes< Vec<N,T>, Vec<N,T>, T> >::Spring > >  *ff)
04353     {
04354         
04355         Q3Table* table = it_list_table->first;
04356         
04357         vector<typename sofa::component::forcefield::SpringForceField< StdVectorTypes< Vec<N,T>, Vec<N,T>, T> >::Spring > new_value;
04358         
04359         for (unsigned int i=0; i<ff->getValue().size(); i++)
04360         {
04361             double values[5];
04362             typename sofa::component::forcefield::SpringForceField< StdVectorTypes< Vec<N,T>, Vec<N,T>, T> >::Spring  current_spring;
04363             for (int j=0;j<5;j++)
04364             {
04365                 values[j] = atof(table->text(i,j));
04366             }
04367             current_spring.m1 = (int) values[0];
04368             current_spring.m2 = (int) values[1];
04369             
04370             current_spring.ks       = values[2];
04371             current_spring.kd       = values[3];
04372             current_spring.initpos  = values[4];
04373             
04374             new_value.push_back(current_spring);
04375         }
04376         ff->setValue( new_value ); 
04377     }
04378 
04379     //********************************************************************************************************************
04380       template< class T>
04381       bool ModifyObject::createQtRigidSpringTable(Data< vector< typename sofa::component::forcefield::JointSpringForceField< StdRigidTypes< 3,T > >::Spring > >  *ff, Q3GroupBox *box, Q3Table* vectorTable )
04382       {     if (!vectorTable)
04383           {
04384         if (ff->getValue().size() == 0  && !EMPTY_FLAG)  return false;
04385         box->setColumns(1);
04386         
04387         if (RESIZABLE_FLAG) vectorTable = addResizableTable(box,ff->getValue().size(),13);
04388         else vectorTable = new Q3Table(ff->getValue().size(),13, box);
04389                 
04390         list_Table.push_back(std::make_pair(vectorTable, ff));
04391         vectorTable->horizontalHeader()->setLabel(0,QString("Index 1"));             
04392         vectorTable->horizontalHeader()->setLabel(1,QString("Index 2"));             
04393         vectorTable->horizontalHeader()->setLabel(2,QString("soft stiffness Trans"));  
04394         vectorTable->horizontalHeader()->setLabel(3,QString("hard stiffness Trans"));  
04395         vectorTable->horizontalHeader()->setLabel(4,QString("soft stiffness Rot"));  
04396         vectorTable->horizontalHeader()->setLabel(5,QString("hard stiffness Rot"));  
04397 
04398         vectorTable->horizontalHeader()->setLabel(6,QString("Kd : damping"));       
04399 
04400         vectorTable->horizontalHeader()->setLabel(7,QString("Angle X min"));  
04401         vectorTable->horizontalHeader()->setLabel(8,QString("Angle X max"));  
04402         vectorTable->horizontalHeader()->setLabel(9,QString("Angle Y min"));  
04403         vectorTable->horizontalHeader()->setLabel(10,QString("Angle Y max"));  
04404         vectorTable->horizontalHeader()->setLabel(11,QString("Angle Z min"));  
04405         vectorTable->horizontalHeader()->setLabel(12,QString("Angle Z max"));  
04406 
04407         connect( vectorTable, SIGNAL( valueChanged(int,int) ), this, SLOT( changeValue() ) );
04408           }
04409 
04410         if (setResize.find(vectorTable) != setResize.end()) ff->beginEdit()->resize(vectorTable->numRows());
04411         else      vectorTable->setNumRows(ff->getValue().size());
04412 
04413         vector<typename sofa::component::forcefield::JointSpringForceField<  StdRigidTypes< 3,T > >::Spring > value = ff->getValue();
04414 
04415         for (unsigned int i=0; i<ff->getValue().size(); i++)
04416           {
04417         std::ostringstream oss[13];
04418         oss[0]  << value[i].m1;          vectorTable->setText(i ,0 ,std::string(oss[0] .str()).c_str());
04419         oss[1]  << value[i].m2;          vectorTable->setText(i ,1 ,std::string(oss[1] .str()).c_str());
04420         oss[2]  << value[i].softStiffnessTrans;  vectorTable->setText(i ,2 ,std::string(oss[2] .str()).c_str());
04421         oss[3]  << value[i].hardStiffnessTrans;  vectorTable->setText(i ,3 ,std::string(oss[3] .str()).c_str());
04422         oss[4]  << value[i].softStiffnessRot;    vectorTable->setText(i ,4 ,std::string(oss[4] .str()).c_str());
04423         oss[5]  << value[i].hardStiffnessRot;    vectorTable->setText(i ,5 ,std::string(oss[5] .str()).c_str());
04424         oss[6]  << value[i].kd;          vectorTable->setText(i ,6 ,std::string(oss[6] .str()).c_str());
04425         oss[7]  << value[i].limitAngles[0];  vectorTable->setText(i ,7 ,std::string(oss[7] .str()).c_str());
04426         oss[8]  << value[i].limitAngles[1];  vectorTable->setText(i ,8 ,std::string(oss[8] .str()).c_str());
04427         oss[9]  << value[i].limitAngles[2];      vectorTable->setText(i, 9 ,std::string(oss[9] .str()).c_str());
04428         oss[10] << value[i].limitAngles[3];      vectorTable->setText(i,10 ,std::string(oss[10].str()).c_str());
04429         oss[11] << value[i].limitAngles[4];      vectorTable->setText(i,11 ,std::string(oss[11].str()).c_str());
04430         oss[12] << value[i].limitAngles[5];      vectorTable->setText(i,12 ,std::string(oss[12].str()).c_str());
04431           }
04432         return true;
04433       }     
04434 
04435     //********************************************************************************************************************
04436     template< class T>
04437     void ModifyObject::storeQtRigidSpringTable( std::list< std::pair< Q3Table*, core::objectmodel::BaseData*> >::iterator &it_list_table, Data< sofa::helper::vector< typename sofa::component::forcefield::JointSpringForceField< StdRigidTypes<3,T> >::Spring > >  *ff )
04438       {
04439       
04440         Q3Table* table = it_list_table->first;
04441       
04442         sofa::helper::vector<  typename sofa::component::forcefield::JointSpringForceField< StdRigidTypes<3,T> >::Spring > new_value;
04443 
04444         for (unsigned int i=0; i<ff->getValue().size(); i++)
04445           {
04446         double values[20];
04447         typename sofa::component::forcefield::JointSpringForceField< StdRigidTypes<3,T> >::Spring current_spring;
04448         for (int j=0;j<20;j++)
04449           {
04450             values[j] = atof(table->text(i,j));
04451           }
04452         current_spring.m1 = (int) values[0];
04453         current_spring.m2 = (int)values[1];
04454 
04455         current_spring.freeMovements[0]       = values[2];
04456         current_spring.freeMovements[1]       = values[3];
04457         current_spring.freeMovements[2]       = values[4];
04458         current_spring.freeMovements[3]       = values[5];
04459         current_spring.freeMovements[4]       = values[6];
04460         current_spring.freeMovements[5]       = values[7];
04461 
04462         current_spring.softStiffnessTrans     = values[8];
04463         current_spring.hardStiffnessTrans     = values[9];
04464         current_spring.softStiffnessRot       = values[10];
04465         current_spring.hardStiffnessRot       = values[11];
04466 
04467         current_spring.kd           = values[12];
04468 
04469         current_spring.initTrans[0] = values[13];
04470         current_spring.initTrans[1] = values[14];
04471         current_spring.initTrans[2] = values[15];
04472 
04473         current_spring.initRot[0]   = values[16];
04474         current_spring.initRot[1]   = values[17];
04475         current_spring.initRot[2]   = values[18];
04476         current_spring.initRot[3]   = values[19];
04477         new_value.push_back(current_spring);
04478           }    
04479         ff->setValue( new_value ); 
04480       }
04481 #endif
04482     //********************************************************************************************************************
04483 
04484       Q3Table *ModifyObject::addResizableTable(Q3GroupBox *box,int number, int column)
04485       {
04486     box->setColumns(2);
04487     QSpinBox *spinBox = new QSpinBox(0,INT_MAX, 1, box);
04488     Q3Table* table = new Q3Table(number,column, box);
04489     spinBox->setValue(number);
04490     resizeMap.insert(std::make_pair(spinBox, table));
04491     connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( resizeTable(int) ) );
04492     return  table;
04493       }
04494 
04495       const core::objectmodel::BaseData* ModifyObject::getData(const QObject *object)
04496       {
04497     for (unsigned int i=0;i<objectGUI.size();++i)
04498       {
04499         if (objectGUI[i].second == object) return  objectGUI[i].first;
04500       }
04501     return false;
04502       }
04503       
04504       void ModifyObject::resizeTable(int number)
04505       {
04506     QSpinBox *spinBox = (QSpinBox *) sender();
04507     Q3Table *table = resizeMap[spinBox];
04508     if (number != table->numRows())
04509       {
04510         table->setNumRows(number);
04511         setResize.insert(table);
04512       }
04513     updateTables();
04514     setResize.clear();
04515       } 
04516 
04517 
04518     } // namespace qt
04519 
04520   } // namespace gui
04521 
04522 } // namespace sofa
04523 

Generated on Sun Nov 23 02:28:36 2008 for Sofa by  doxygen 1.5.7.1