]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
rnc: Start_BR_19998_21191_NEW_ENV
authorgdd <gdd>
Tue, 19 Apr 2011 13:20:04 +0000 (13:20 +0000)
committergdd <gdd>
Tue, 19 Apr 2011 13:20:04 +0000 (13:20 +0000)
- Made possible to define attractors as compounds
- Removed some useless parts and comments
- Restored lost code due to merge (to allow saving to hdf)

src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx
src/BLSURFPlugin/BLSURFPlugin_Attractor.hxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx

index 364adb17c90c601ad1dc21e6906f300b2ad8317d..457fd434281848c5075305832446a3fec17f8eff 100644 (file)
@@ -43,7 +43,6 @@ BLSURFPlugin_Attractor::BLSURFPlugin_Attractor ()
   : _face(),
   _attractorShape(),
   _attEntry(),
-  _step(0),
   _gridU(0),
   _gridV(0),
   _vectU(),
@@ -63,11 +62,10 @@ BLSURFPlugin_Attractor::BLSURFPlugin_Attractor ()
   _isMapBuilt(false),
   _isEmpty(true){ MESSAGE("construction of a void attractor"); }
 
-BLSURFPlugin_Attractor::BLSURFPlugin_Attractor (const TopoDS_Face& Face, const TopoDS_Shape& Attractor, const std::string& attEntry, double Step) // TODO Step is now unused -> remove it if testing is OK
+BLSURFPlugin_Attractor::BLSURFPlugin_Attractor (const TopoDS_Face& Face, const TopoDS_Shape& Attractor, const std::string& attEntry
   : _face(),
   _attractorShape(),
   _attEntry(attEntry),
-  _step(),
   _gridU(),
   _gridV(),
   _vectU(),
@@ -106,10 +104,9 @@ bool BLSURFPlugin_Attractor::init(){
   MESSAGE("v1 = "<<_v1<<" ,v2  = "<<_v2);
 //   _gridU = floor (_u2 - _u1) / _step;
 //   _gridV = floor (_v2 - _v1) / _step;
-  // TEST
+
   _gridU = 300;
   _gridV = 300;
-  _step = std::min((_u2-_u1)/_gridU,(_v2-_v1)/_gridV);
 
   for (i=0; i<=_gridU; i++){
     _vectU.push_back(_u1+i*(_u2-_u1)/_gridU) ;
@@ -127,11 +124,21 @@ bool BLSURFPlugin_Attractor::init(){
   for (i=0; i<=_gridU; i++){
     _known.push_back(temp2);
   }
-
+  
+  
   // Determination of the starting points
-  if (_attractorShape.ShapeType() == TopAbs_VERTEX){ 
+  TopExp_Explorer anEdgeExp(_attractorShape, TopAbs_EDGE, TopAbs_FACE);
+  TopExp_Explorer aVertExp(_attractorShape, TopAbs_VERTEX, TopAbs_EDGE);
+  
+  for(; anEdgeExp.More(); anEdgeExp.Next()){
+    const TopoDS_Edge& anEdge = TopoDS::Edge(anEdgeExp.Current());
+    edgeInit(aSurf, anEdge);
+  }
+  
+  for(; aVertExp.More(); aVertExp.Next()){
+    const TopoDS_Vertex& aVertex = TopoDS::Vertex(aVertExp.Current());
     Trial_Pnt TPnt(3,0); 
-    gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(_attractorShape));
+    gp_Pnt P = BRep_Tool::Pnt(aVertex);
     GeomAPI_ProjectPointOnSurf projector( P, aSurf );
     projector.LowerDistanceParameters(u0,v0);
     MESSAGE("u0 = "<<u0<<" ,v0  = "<<v0);
@@ -143,17 +150,6 @@ bool BLSURFPlugin_Attractor::init(){
     _DMap[i0][j0] = 0.;
     _trial.insert(TPnt);         // Move starting point to _trial
   }
-  else if (_attractorShape.ShapeType() == TopAbs_EDGE){
-    const TopoDS_Edge& anEdge = TopoDS::Edge(_attractorShape);
-    edgeInit(aSurf, anEdge);
-  }
-  else if (_attractorShape.ShapeType() == TopAbs_WIRE){
-    TopExp_Explorer anExp(_attractorShape, TopAbs_EDGE);
-    for(; anExp.More(); anExp.Next()){
-      const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
-      edgeInit(aSurf, anEdge);
-    }
-  }
     
 }
 
@@ -170,7 +166,7 @@ void BLSURFPlugin_Attractor::edgeInit(Handle(Geom_Surface) theSurf, const TopoDS
   curveProjector.PerformAdvanced (aCurve3d, first, last, aCurve2d);
   //int N = 20 * (last - first) / _step;  // If the edge is a circle : 4>Pi so the number of points on the edge should be good -> 5 for ellipses
   int N = 1200;
-  MESSAGE("Initialisation des points de départ")
+  MESSAGE("Initialization of the starting points")
   for (i=0; i<=N; i++){
     P2 = aCurve2d->Value(first + i * (last-first) / N);
     i0 = floor( (P2.X() - _u1) * _gridU / (_u2 - _u1) + 0.5 );
@@ -263,26 +259,26 @@ double BLSURFPlugin_Attractor::_distance(double u, double v){
 
 double BLSURFPlugin_Attractor::GetSize(double u, double v){   
   double myDist = 0.5 * (_distance(u,v) - _constantRadius + fabs(_distance(u,v) - _constantRadius));
-  if (myDist<0){
-    MESSAGE("Warning myDist<0 : myDist= "<<myDist)
-  }
+//   if (myDist<0){
+//     MESSAGE("Warning myDist<0 : myDist= "<<myDist)
+//   }
   switch(_type)
   {
     case TYPE_EXP:
-      if (fabs(_actionRadius) < 1e-12){ // TODO definir eps et decommenter
-       if (myDist < 1e-12){
-         return _startSize;
-       }
-       else {
-         return _endSize;
-       }
+      if (fabs(_actionRadius) <= std::numeric_limits<double>::epsilon()){ 
+        if (myDist <= std::numeric_limits<double>::epsilon()){
+          return _startSize;
+        }
+        else {
+          return _endSize;
+        }
       }
       else{
-       return _endSize - (_endSize - _startSize) * exp(- myDist * myDist / (_actionRadius * _actionRadius) );
+        return _endSize - (_endSize - _startSize) * exp(- myDist * myDist / (_actionRadius * _actionRadius) );
       }
       break;
     case TYPE_LIN:
-      return _startSize + ( 0.5 * (_distance(u,v) - _constantRadius + abs(_distance(u,v) - _constantRadius)) ) ;
+        return _startSize + ( 0.5 * (_distance(u,v) - _constantRadius + abs(_distance(u,v) - _constantRadius)) ) ;
       break;
   }
 }
index 12e26913033cb7759ce4920fdb1b431e8909bfb6..a16e69d3bcd541e872bef91da07f880f8145a815 100644 (file)
@@ -88,7 +88,7 @@ class BLSURFPlugin_Attractor {
   public:
     
     BLSURFPlugin_Attractor ();
-    BLSURFPlugin_Attractor (const TopoDS_Face& Face, const TopoDS_Shape& Attractor, const std::string& attEntry, double Step = 0.015);
+    BLSURFPlugin_Attractor (const TopoDS_Face& Face, const TopoDS_Shape& Attractor, const std::string& attEntry); //, double Step = 0.015);
     bool init();                                                // Calculates the discrete points correponding to attractor 
                                                                 // and intialises the map of distances
     void edgeInit(Handle(Geom_Surface) aSurf, const TopoDS_Edge& anEdge);
@@ -97,7 +97,7 @@ class BLSURFPlugin_Attractor {
     TopoDS_Face         GetFace()           const { return _face; }
     TopoDS_Shape        GetAttractorShape() const { return _attractorShape; }
     std::string         GetAttractorEntry() const { return _attEntry; }
-    double              GetStep()           const { return _step; }
+//     double              GetStep()           const { return _step; }
     std::vector<double> GetParameters()     const 
     { 
       double tab_params[] = {_startSize, _endSize, _actionRadius, _constantRadius}; 
@@ -130,7 +130,7 @@ class BLSURFPlugin_Attractor {
     TPointSet         _known;
     TTrialSet         _trial;
     int               _type;                                    // Type of function used to calculate the size from the distance (unused for now)
-    double            _step;                                    // Step between two values of the discretized parametric space in U or V direction
+//     double            _step;                                    // Step between two values of the discretized parametric space in U or V direction
     int               _gridU;                                   // Number of grid points in U direction
     int               _gridV;                                   // Number of grid points in V direction
     double            _u1, _u2, _v1, _v2;                       // Bounds of the parametric space of the face 
index b5b631dba381a2a9518ad700ce5c4f877619de6e..2a7766f0b18ce74224d3a33854ba3aae2330fd59 100644 (file)
@@ -887,7 +887,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
       if ( !AtIt->second->Empty() ) {
        // MESSAGE("blsurf_set_attractor(): " << AtIt->first << " = " << AtIt->second);
         GeomShape = entryToShape(AtIt->first);
-       AttShape = AtIt->second->GetAttractorShape();
+        AttShape = AtIt->second->GetAttractorShape();
         GeomType  = GeomShape.ShapeType();
         // Group Management
 //         if (GeomType == TopAbs_COMPOUND){
@@ -902,20 +902,23 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
         if (GeomType == TopAbs_FACE 
           && (AttShape.ShapeType() == TopAbs_VERTEX 
            || AttShape.ShapeType() == TopAbs_EDGE 
-           || AttShape.ShapeType() == TopAbs_WIRE)){
-         HasSizeMapOnFace = true;
-         if (! FacesWithSizeMap.Contains(TopoDS::Face(GeomShape)) ) {
+           || AttShape.ShapeType() == TopAbs_WIRE  
+           || AttShape.ShapeType() == TopAbs_COMPOUND) ){
+            HasSizeMapOnFace = true;
+            
+            if (! FacesWithSizeMap.Contains(TopoDS::Face(GeomShape)) ) {
                 key = FacesWithSizeMap.Add(TopoDS::Face(GeomShape) );
-              }
-              else {
-                key = FacesWithSizeMap.FindIndex(TopoDS::Face(GeomShape));
+            }
+            else {
+              key = FacesWithSizeMap.FindIndex(TopoDS::Face(GeomShape));
 //                 MESSAGE("Face with key " << key << " already in map");
-              }
-              FaceId2ClassAttractor[key] = AtIt->second;
+            }
+            
+            FaceId2ClassAttractor[key] = AtIt->second;
         }
         else{
-         MESSAGE("Wrong shape type !!")
-       }
+          MESSAGE("Wrong shape type !!")
+        }
 
       }
     }
index 83ddca1df22a1b3cb72c55e4353fd56960ce16b4..b2617dca8a603d14504822b2a0463fbfc3a35c0a 100644 (file)
@@ -412,8 +412,8 @@ void BLSURFPlugin_Hypothesis::SetClassAttractorEntry(const std::string& entry, c
   
   if ( !attExists || (attExists && _classAttractors[entry]->GetAttractorEntry().compare(attEntry) != 0)){ 
     ShapeAnalysis::GetFaceUVBounds(FaceShape,u1,u2,v1,v2);
-    diag = sqrt((u2 - u1) * (u2 - u1) + (v2 - v1) * (v2 - v1));  
-    BLSURFPlugin_Attractor* myAttractor = new BLSURFPlugin_Attractor(FaceShape, AttractorShape, attEntry, 0.1 ); // test 0.002 * diag); 
+//     diag = sqrt((u2 - u1) * (u2 - u1) + (v2 - v1) * (v2 - v1));  
+    BLSURFPlugin_Attractor* myAttractor = new BLSURFPlugin_Attractor(FaceShape, AttractorShape, attEntry);//, 0.1 ); // test 0.002 * diag); 
     myAttractor->BuildMap();
     myAttractor->SetParameters(StartSize, EndSize, ActionRadius, ConstantRadius);
     _classAttractors[entry] = myAttractor;
@@ -956,15 +956,15 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
     for (; it_At != _classAttractors.end(); ++it_At) {
       std::vector<double> attParams;
       attParams   = it_At->second->GetParameters();
-      double step = it_At->second->GetStep();
+//       double step = it_At->second->GetStep();
       save << " " << it_At->first;
       save << " " << it_At->second->GetAttractorEntry();
       save << " " << attParams[0]  << " " <<  attParams[1] << " " <<  attParams[2] << " " <<  attParams[3];
-      save << " " << step;
+//       save << " " << step;
       test << " " << it_At->first;
       test << " " << it_At->second->GetAttractorEntry();
       test << " " << attParams[0]  << " " <<  attParams[1] << " " <<  attParams[2] << " " <<  attParams[3];
-      test << " " << step;
+//       test << " " << step;
     }
     save << " " << "__NEW_ATTRACTORS_END__";
     test << " " << "__NEW_ATTRACTORS_END__";
@@ -1240,6 +1240,40 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
         hasEnforcedVertex = true;
   }
 
+  std::string newAtFaceEntry, atTestString;
+  std::string newAtShapeEntry;
+  double attParams[4];
+  double step;
+  while (isOK && hasNewAttractor) {
+    std::cout<<"Load new attractor"<<std::endl;
+    isOK = (load >> newAtFaceEntry);
+    if (isOK) {
+      if (newAtFaceEntry == "__NEW_ATTRACTORS_END__")
+        break;
+      isOK = (load >> newAtShapeEntry);
+      if (!isOK)
+    break;
+      isOK = (load >> attParams[0]>>attParams[1]>>attParams[2]>>attParams[3]); //>>step);
+    }
+    if (isOK) {
+      MESSAGE(" LOADING ATTRACTOR HYPOTHESIS ")
+      const TopoDS_Shape attractorShape = BLSURFPlugin_Hypothesis::entryToShape(newAtShapeEntry);
+      const TopoDS_Face faceShape = TopoDS::Face(BLSURFPlugin_Hypothesis::entryToShape(newAtFaceEntry));
+      BLSURFPlugin_Attractor* attractor = new BLSURFPlugin_Attractor(faceShape, attractorShape, newAtShapeEntry);//, step);
+      attractor->SetParameters(attParams[0], attParams[1], attParams[2], attParams[3]);
+      attractor->BuildMap();                     
+      _classAttractors[newAtFaceEntry]=attractor;
+    }
+  }
+  
+  
+  if (hasNewAttractor) {
+    isOK = (load >> option_or_sm);
+    if (isOK)
+      if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
+        hasEnforcedVertex = true;
+  }
+
 
 // 
 // Here is a example of the saved stream:
index 74c17149776d52346928860b4752cfb3c1c20c63..6c0f6050e72cede8aa9cd20a761932355791e33d 100644 (file)
@@ -820,6 +820,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   ATT_ShapeTypes.Add( TopAbs_VERTEX );
   ATT_ShapeTypes.Add( TopAbs_EDGE );
   ATT_ShapeTypes.Add( TopAbs_WIRE );
+  ATT_ShapeTypes.Add( TopAbs_COMPOUND );
   
   SMESH_NumberFilter* myFilter1 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, SM_ShapeTypes);
   SMESH_NumberFilter* myFilter2 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, ATT_ShapeTypes);
@@ -1499,15 +1500,15 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
       if ( name_value.count() > 1 ) {
         QString idStr = QString("%1").arg( i );
         int row = myOptionTable->rowCount();
-       myOptionTable->setRowCount( row+1 );
-       myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
-       myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
-       myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) );
-       myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
-       myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) );
-       myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                                  Qt::ItemIsEditable   |
-                                                                  Qt::ItemIsEnabled );
+        myOptionTable->setRowCount( row+1 );
+        myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
+        myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
+        myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) );
+        myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
+        myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) );
+        myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
+                                      Qt::ItemIsEditable   |
+                                      Qt::ItemIsEnabled );
       }
     }
   }
@@ -1520,10 +1521,9 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
   while (i.hasNext()) {
     i.next();
     const QString entry = i.key();
-    string shapeName = myGeomToolSelected->getNameFromEntry(entry.toStdString()); 
     const QString sizeMap = i.value();
+    string shapeName = myGeomToolSelected->getNameFromEntry(entry.toStdString()); 
     int row = mySizeMapTable->topLevelItemCount();
-//     mySizeMapTable->setRowCount( row+1 );
     QTreeWidgetItem* item = new QTreeWidgetItem();
     mySizeMapTable->addTopLevelItem( item ); 
     item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
@@ -1539,35 +1539,17 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
       child->setData(SMP_ENTRY_COLUMN, Qt::DisplayRole, QVariant( attEntry  ) );
       child->setData(SMP_NAME_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString( attName ) ) );
    
-      if (that->myAttDistMap[entry] > 1e-12){
-       item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString("Attractor" )  ) );
-       /*mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( QString::number( that->myDistMap[entry], 'g',  6) ) );
-       mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                               Qt::ItemIsEnabled );*/                                                         
+      if (that->myAttDistMap[entry] >  std::numeric_limits<double>::epsilon()){
+        item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString("Attractor" )  ) ); 
       }
       else{
-       item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString("Constant Size" )  ) );
-//     mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( QString::fromStdString("Constant size") );
-//     mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |
-//                                                                Qt::ItemIsEnabled );
-//     mySizeMapTable->item( row, SMP_NAME_COLUMN)->setText(QString::fromStdString(shapeName));
-//     mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( QString::number( that->myDistMap[entry], 'g',  6) ));
-//     mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |
-//                                                                Qt::ItemIsEnabled ); 
+        item->setData(SMP_SIZEMAP_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString("Constant Size" )  ) );
       }
     }
     else
     {
       item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap ) );
-//       mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( sizeMap ) ); 
-//       mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |
-//                                                                Qt::ItemIsEditable   |
-//                                                                Qt::ItemIsEnabled );
-     /* mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( QString::number( that->myDistMap[entry], 'g',  6) ) );
-      mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                               Qt::ItemIsEnabled );    */                                             
-    }
-    
+    } 
   }
   mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
@@ -2301,27 +2283,27 @@ void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item,
       CORBA::Object_var attObj = entryToObject(attEntry);
       myAttSizeSpin->setValue(phySize);
       if (sizeMap.startsWith("Attractor")){    
-       myAttDistSpin->setValue(infDist);
+        myAttDistSpin->setValue(infDist);
         myAttractorCheck->setChecked(true);
       }
       else {
-       myAttractorCheck->setChecked(false);
+        myAttractorCheck->setChecked(false);
       }
-      if (sizeMap.startsWith("Constant") || constDist > 1e-12 ){
-       myAttDistSpin2->setValue(constDist);
-       myConstSizeCheck->setChecked(true);
+      if (sizeMap.startsWith("Constant") || constDist > std::numeric_limits<double>::epsilon()){
+        myAttDistSpin2->setValue(constDist);
+        myConstSizeCheck->setChecked(true);
       }
       else{
-       myConstSizeCheck->setChecked(false);
+        myConstSizeCheck->setChecked(false);
       }
       myGeomSelWdg2->SetObject(obj); 
       myAttSelWdg->SetObject(attObj);
     }
     else {                                                                   // CLASSIC MAPS
       smpTab->setCurrentIndex(SMP_STD_TAB);  // Change Tab
-      myGeomSelWdg1->SetObject(obj);        // Retrieve values of the selected item in the current tab widgets
+      myGeomSelWdg1->SetObject(obj);         // Retrieve values of the selected item in the current tab widgets
       if (!sizeMap.startsWith("def")){
-       mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble()); 
+        mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble()); 
       }
     }  
   } 
@@ -2346,40 +2328,28 @@ void BLSURFPluginGUI_HypothesisCreator::onSmpTabChanged(int tab)
 void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state)
 {
   if (state == Qt::Checked){
-//     myParamsGroup->setEnabled(true);
     myAttSelWdg->setEnabled(true);
     myAttSizeSpin->setEnabled(true);
     myAttSizeLabel->setEnabled(true);
     myAttDistSpin->setEnabled(true);
     myAttDistLabel->setEnabled(true);
-//     myAttDistSpin2->setEnabled(true);
-//     myAttDistLabel2->setEnabled(true);
     if (!myAttSelWdg->IsObjectSelected()){
       myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
     }
-//     if(myConstSizeCheck->checkState() == Qt::Checked){   // Only attractor
-//       myAttDistSpin2->setEnabled(true);
-//       myAttDistLabel2->setEnabled(true);
-// //       myAttDistSpin2->setValue(0.);
-//     }
   }
   if (state == Qt::Unchecked){
     myAttDistSpin->setEnabled(false);
     myAttDistLabel->setEnabled(false);
     myAttDistSpin->setValue(0.);
     if(myConstSizeCheck->checkState() == Qt::Unchecked){  // No predefined map selected
-        myAttSelWdg->setEnabled(false);
-        myAttSizeSpin->setEnabled(false);
-        myAttSizeLabel->setEnabled(false);
-        myAttDistSpin2->setEnabled(false);
-        myAttDistLabel2->setEnabled(false);
-//       myParamsGroup->setEnabled(false);
+      myAttSelWdg->setEnabled(false);
+      myAttSizeSpin->setEnabled(false);
+      myAttSizeLabel->setEnabled(false);
+      myAttDistSpin2->setEnabled(false);
+      myAttDistLabel2->setEnabled(false);
     }
     else if (!myAttSelWdg->IsObjectSelected()){           // Only constant size selected
-//       myAttDistSpin->setEnabled(false);
-//       myAttDistLabel->setEnabled(false);
-//       myAttDistSpin->setValue(0.);
-       myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
+      myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
     }
   }   
 }
@@ -2392,13 +2362,6 @@ void BLSURFPluginGUI_HypothesisCreator::onConstSizeClicked(int state)
     myAttSizeLabel->setEnabled(true);
     myAttDistSpin2->setEnabled(true);
     myAttDistLabel2->setEnabled(true);
-//     myAttDistSpin2->setEnabled(true);
-//     myAttDistLabel2->setEnabled(true);
-//     if(myConstSizeCheck->checkState() == Qt::Checked){   // Only attractor
-//       myAttDistSpin2->setEnabled(true);
-//       myAttDistLabel2->setEnabled(true);
-// //       myAttDistSpin2->setValue(0.);
-//     }
     if (myAttractorCheck->checkState() == Qt::Unchecked &&
         !myAttSelWdg->IsObjectSelected()){
       myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
@@ -2414,41 +2377,11 @@ void BLSURFPluginGUI_HypothesisCreator::onConstSizeClicked(int state)
         myAttSizeLabel->setEnabled(false);
         myAttDistSpin->setEnabled(false);
         myAttDistLabel->setEnabled(false);
-//       myParamsGroup->setEnabled(false);
     }
     else if (!myAttSelWdg->IsObjectSelected()){           // Only constant size selected
-//       myAttDistSpin->setEnabled(false);
-//       myAttDistLabel->setEnabled(false);
-//       myAttDistSpin->setValue(0.);
     myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }");
     }
-  }  
-    
-//   if (state == Qt::Checked){
-//     myParamsGroup->setEnabled(true);
-//     myAttDistSpin->setEnabled(true);
-//     myAttDistLabel->setEnabled(true);
-//     myAttDistSpin2->setEnabled(true);
-//     myAttDistLabel2->setEnabled(true);
-//     if(myAttractorCheck->checkState() == Qt::Unchecked){  // Only constant size
-//       myAttDistSpin->setEnabled(false);
-//       myAttDistLabel->setEnabled(false);
-//       myAttDistSpin->setValue(0.);
-//       if (!myAttSelWdg->IsObjectSelected()){
-//     myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
-//       }
-//     }
-//   }
-//   if (state == Qt::Unchecked){
-//     if(myAttractorCheck->checkState() == Qt::Unchecked){  // No predefined map selected
-//       myParamsGroup->setEnabled(false);
-//     }
-//     else{
-//       myAttDistSpin2->setEnabled(false);                  // Only attractor selected  
-//       myAttDistLabel2->setEnabled(false);
-//       myAttDistSpin2->setValue(0.);
-//     }
-//   }   
+  }   
 }
 
 void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
@@ -2457,11 +2390,6 @@ void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
   QList<int> selectedRows;
   QList<QTreeWidgetItem*> selected = mySizeMapTable->selectedItems();
   QTreeWidgetItem* item;
-//   foreach( item, selected ) {
-//     if ( !selected.contains( item ) )
-//       selected.append( row );
-//   }
-
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
 
   qSort( selectedRows );
@@ -2499,29 +2427,18 @@ void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int
       return;
     if (that->mySMPMap.contains(entry))
       if (that->mySMPMap[entry] == sizeMap 
-       || sizeMap.startsWith("Attractor") 
-       || sizeMap.startsWith("Constant") ){
+        || sizeMap.startsWith("Attractor") 
+        || sizeMap.startsWith("Constant") ){
         return;
-      }
-//     QColor* bgColor = new QColor("white");
-//     QColor* fgColor = new QColor("black");
-    
+      } 
     if (! sizeMap.isEmpty()) {
       that->mySMPMap[entry] = sizeMap;
       sizeMapValidationFromEntry(entry); 
-//       if (! sizeMapValidationFromRow(row)) {
-//         bgColor->setRgb(255,0,0);
-//         fgColor->setRgb(255,255,255);
-//       }
     }
     else {
       MESSAGE("Size map empty: reverse to precedent value" );
       item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(that->mySMPMap[entry]) );
     }
-//     that->mySizeMapTable->item(row, SMP_NAME_COLUMN)->setBackground(QBrush(*bgColor));
-//     that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setBackground(QBrush(*bgColor));
-//     that->mySizeMapTable->item(row, SMP_NAME_COLUMN)->setForeground(QBrush(*fgColor));
-//     that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setForeground(QBrush(*fgColor));
     mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
   }
 }
@@ -2553,8 +2470,6 @@ void BLSURFPluginGUI_HypothesisCreator::onAddMap()
   myGeomSelWdg1->SetObject(CORBA::Object::_nil());
   myGeomSelWdg2->SetObject(CORBA::Object::_nil());
   myAttSelWdg->SetObject(CORBA::Object::_nil());
-//   mySmpDistSpin->setValue(0.);
-//   mySmpSizeSpin->setValue(0.);
 }
 
 void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
@@ -2609,8 +2524,6 @@ void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb
   oss << phySize;
   QString sizeMap;
   sizeMap  = QString::fromStdString(oss.str());
- // int row = mySizeMapTable->rowCount();
- // mySizeMapTable->setRowCount( row + 1 );
   QTreeWidgetItem* item = new QTreeWidgetItem();
   if (modify){
     int rowToChange = findRowFromEntry(shapeEntry);
@@ -2636,7 +2549,6 @@ void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
   mySizeMapTable->clearSelection();
-//   mySizeMapTable->scrollToItem( mySizeMapTable->item( row  , SMP_SIZEMAP_COLUMN ) ); //TODO voir si cette option est utile
 
   if ( myPhysicalMesh->currentIndex() != SizeMap ) {
     myPhysicalMesh->setCurrentIndex( SizeMap );
@@ -2683,8 +2595,6 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
   QString infDistString = QString::fromStdString(oss2.str());
   QString constDistString = QString::fromStdString(oss3.str());
   
-//   int row = mySizeMapTable->topLevelItemCount();
-//   int rowToChange;
   QTreeWidgetItem* item; 
   QTreeWidgetItem* child; 
   if (modify){
@@ -2696,7 +2606,7 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
     if (that->mySMPMap.contains(shapeEntry)) {  
       if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
     //             MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
-       return;
+        return;
       }
     }
     item = new QTreeWidgetItem();
@@ -2712,10 +2622,10 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
   item->setExpanded(true); 
   item->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(shapeEntry) );
   item->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(faceName)) );
-  if (infDist > 1e-12){
+  if (infDist > std::numeric_limits<double>::epsilon()){
     item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Attractor")) );
   }
-  else if (constDist > 1e-12){
+  else if (constDist > std::numeric_limits<double>::epsilon()){
     item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Constant Size")) );
   }
   item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable   |Qt::ItemIsEnabled );    
@@ -2727,8 +2637,6 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
   mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
-//  mySizeMapTable->clearSelection();
-//  mySizeMapTable->scrollToItem( mySizeMapTable->item( row  , SMP_SIZEMAP_COLUMN ) );//TODO voir si l'option est utile
 
   if ( myPhysicalMesh->currentIndex() != SizeMap ) {
     myPhysicalMesh->setCurrentIndex( SizeMap );
@@ -2851,43 +2759,6 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEnt
   return true;
 }
 
-/*
-void BLSURFPluginGUI_HypothesisCreator::OnEditMapFunction(QModelIndex* index) {
-  int myRow = index->row();
-  int myColumn = index->column();
-
-  if (myColumn == 2){
-     if (!myEditor) {
-         myEditor = new BLSURFPluginGUI_MapFunctionEditor(sizeMapModel->item(myRow,0)->text());
-        connect(myEditor, SIGNAL(FunctionEntered(QString)), this, SLOT(FunctionLightValidation(QString)));
-     }
-     myEditor->exec();
-//      myEditor->show();
-//      myEditor->raise();
-//      myEditor->activateWindow();
-
-
-//     BLSURFPluginGUI_MapFunctionEditor* myEditor = new BLSURFPluginGUI_MapFunctionEditor(sizeMapModel->item(myRow,0)->text());
-//     myEditor->exec();
-     QString myFunction = myEditor->GetFunctionText();
-     // FIN RECUPERATION FONCTION
-
-     if (! myFunction.isEmpty()) {
-
-     // MAJ DE LA MAP
-
-     BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
-       BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
-
-//     h->SetSizeMapEntry(sizeMapModel->item(myRow,1)->text().toLatin1().constData(),
-//                        item->text().toLatin1().constData());
-     h->SetSizeMapEntry(sizeMapModel->item(myRow,1)->text().toLatin1().constData(),
-                        myFunction.toLatin1().constData());
-     // FIN MAJ DE LA MAP
-     }
-  }
-}*/
-
 QString BLSURFPluginGUI_HypothesisCreator::caption() const
 {
   return tr( "BLSURF_TITLE" );