]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
Merge from BR_ATTRACTOR_GEO
authorgdd <gdd>
Fri, 8 Apr 2011 09:50:08 +0000 (09:50 +0000)
committergdd <gdd>
Fri, 8 Apr 2011 09:50:08 +0000 (09:50 +0000)
idl/BLSURFPlugin_Algorithm.idl
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/BLSURFPlugin/Makefile.am
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.h
src/GUI/BLSURFPlugin_msg_en.ts
src/GUI/BLSURFPlugin_msg_fr.ts

index 44de7311eaba4b085646cd074e806f647eff6d86..d4760080d589b3d5eddebdc427c55962442984ae 100644 (file)
@@ -37,11 +37,11 @@ module BLSURFPlugin
 {
   typedef sequence<string> string_array;
 
+  // Enforced vertex name
+  typedef string TEnfName;
   // Entry
   typedef string TEntry;
   typedef sequence<TEntry> TEntryList;
-  // Enforced vertex name
-  typedef string TEnfName;
   // Group name
   typedef string TEnfGroupName;
   
@@ -95,7 +95,18 @@ module BLSURFPlugin
     TEnfVertex enfVertex;
   };
   typedef sequence<TEnfVertexEntryEnfVertexElement> TEnfVertexEntryEnfVertexMap;
-  
+
+  // Attractors
+  struct TAttractorParams {
+    string faceEntry;
+    string attEntry;
+    double startSize;
+    double endSize;
+    double infDist;
+    double constDist;
+  };
+  typedef sequence<TAttractorParams> TAttParamsMap;
+
   /* TODO GROUPS
   // Map Group Name / List of enforced vertices
   struct TGroupNameEnfVertexListMapElement {
@@ -267,6 +278,20 @@ module BLSURFPlugin
     string       GetAttractorEntry(in string entry);
     string_array GetAttractorEntries();
 
+    /*!
+     * Set/unset an attractor given as geom object on another geom object
+     */
+    void         SetAttractorGeom(in GEOM::GEOM_Object GeomObj, in GEOM::GEOM_Object AttractorShape, in double StartSize, in double EndSize, in double ActionRadius, in double ConstantRadius);
+    void         UnsetAttractorGeom(in GEOM::GEOM_Object GeomObj);
+
+    /*!
+     * Set an attractor given by entry on a geom object given by entry
+     */
+    void         SetClassAttractorEntry(in string entry, in string att_entry, in double StartSize, in double EndSize, in double ActionRadius, in double ConstantRadius );
+    BLSURFPlugin::TAttParamsMap GetAttractorParams();
+
+
+
 /*
     void         SetCustomSizeMapEntry(in string entry, in string sizeMap);
     string       GetCustomSizeMapEntry(in string entry);
index 51c77bab7066426a6c92162cf224c34c7f6378b0..0ddcb93967977dbd795567156ca0941ddb3877df 100644 (file)
@@ -25,6 +25,8 @@
 // ---
 //
 #include "BLSURFPlugin_BLSURF.hxx"
+#include "BLSURFPlugin_Hypothesis.hxx"
+#include "BLSURFPlugin_Attractor.hxx"
 
 extern "C"{
 #include <distene/api.h>
@@ -71,9 +73,11 @@ extern "C"{
 #include <TopoDS_Face.hxx>
 
 #include <gp_Pnt2d.hxx>
+#include <gp_Pnt.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TopoDS_Shape.hxx>
 #include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
 #include <BRepTools.hxx>
 
 #include <TopTools_DataMapOfShapeInteger.hxx>
@@ -209,7 +213,9 @@ std::map<int,PyObject*> FaceId2PythonSmp;
 std::map<int,PyObject*> EdgeId2PythonSmp;
 std::map<int,PyObject*> VertexId2PythonSmp;
 
-std::map<int,BLSURFPlugin_Hypothesis::TEnfVertexCoords > FaceId2AttractorCoords;
+std::map<int,std::vector<double> > FaceId2AttractorCoords;
+std::map<int,BLSURFPlugin_Attractor*> FaceId2ClassAttractor;
+std::map<int,BLSURFPlugin_Attractor*> FaceIndex2ClassAttractor;
 
 TopTools_IndexedMapOfShape FacesWithEnforcedVertices;
 std::map< int, BLSURFPlugin_Hypothesis::TEnfVertexCoordsList > FaceId2EnforcedVertexCoords;
@@ -219,6 +225,7 @@ std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TE
 bool HasSizeMapOnFace=false;
 bool HasSizeMapOnEdge=false;
 bool HasSizeMapOnVertex=false;
+//bool HasAttractorOnFace=false;
 
 //=============================================================================
 /*!
@@ -274,6 +281,8 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId,
   EdgeId2PythonSmp.clear();
   VertexId2PythonSmp.clear();
   FaceId2AttractorCoords.clear();
+  FaceId2ClassAttractor.clear();
+  FaceIndex2ClassAttractor.clear();
   FacesWithEnforcedVertices.Clear();
   FaceId2EnforcedVertexCoords.clear();
   EnfVertexCoords2ProjVertex.clear();
@@ -613,8 +622,8 @@ void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction
   attractorFunctionStream << "def f(u,v): return ";
   attractorFunctionStream << _smp_phy_size << "-(" << _smp_phy_size <<"-" << a << ")";
   //attractorFunctionStream << "*exp(-((u-("<<u0<<"))*(u-("<<u0<<"))+(v-("<<v0<<"))*(v-("<<v0<<")))/(" << b << "*" << b <<"))";
-  // rnc make possible to keep the size constant until 
-  // a defined distance distance is expressed as the positiv part 
+  // rnc: make possible to keep the size constant until 
+  // a defined distance. Distance is expressed as the positiv part 
   // of r-d where r is the distance to (u0,v0)
   attractorFunctionStream << "*exp(-(0.5*(sqrt((u-"<<u0<<")**2+(v-"<<v0<<")**2)-"<<d<<"+abs(sqrt((u-"<<u0<<")**2+(v-"<<v0<<")**2)-"<<d<<"))/(" << b << "))**2)"; 
 
@@ -632,6 +641,24 @@ void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction
     MESSAGE("Creating node on ("<<x0<<","<<y0<<","<<z0<<")");
     FaceId2AttractorCoords[key] = coords;
   }
+//   // Test for new attractors
+//   gp_Pnt myP(xyzPoint);
+//   TopoDS_Vertex myV = BRepBuilderAPI_MakeVertex(myP);
+//   BLSURFPlugin_Attractor myAttractor(TopoDS::Face(GeomShape),myV,200);
+//   myAttractor.SetParameters(a, _smp_phy_size, b, d);
+//   myAttractor.SetType(1);
+//   FaceId2ClassAttractor[key] = myAttractor;
+//   if(FaceId2ClassAttractor[key].GetFace().IsNull()){
+//     MESSAGE("face nulle ");
+//   }
+//   else
+//     MESSAGE("face OK");
+//   
+//   if (FaceId2ClassAttractor[key].GetAttractorShape().IsNull()){
+//     MESSAGE("pas de point");
+//   }
+//   else
+//     MESSAGE("point OK");
 }
 
 /////////////////////////////////////////////////////////
@@ -697,6 +724,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
 //  blsurf_set_param(bls, "hphy_flag",         "2");
   if ((to_string(_physicalMesh))=="2"){
     TopoDS_Shape GeomShape;
+    TopoDS_Shape AttShape;
     TopAbs_ShapeEnum GeomType;
     //
     // Standard Size Maps
@@ -802,6 +830,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
     //
     // Attractors
     //
+    // TODO appeler le constructeur des attracteurs directement ici
     MESSAGE("Setting Attractors");
     const BLSURFPlugin_Hypothesis::TSizeMap attractors = BLSURFPlugin_Hypothesis::GetAttractorEntries(hyp);
     BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
@@ -839,7 +868,56 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
 */
       }
     }
+    
+    // Class Attractors
+    // temporary commented out for testing
+    // TODO 
+    //  - Fill in the BLSURFPlugin_Hypothesis::TAttractorMap map in the hypothesis
+    //  - Uncomment and complete this part to construct the attractors from the attractor shape and the passed parameters on each face of the map
+    //  - To do this use the public methodss: SetParameters(several double parameters) and SetType(int type)
+    //  OR, even better:
+    //  - Construct the attractors with an empty dist. map in the hypothesis
+    //  - build the map here for each face with an attractor set and only if the attractor shape as changed since the last call to _buildmap()
+    //  -> define a bool _mapbuilt in the class that is set to false by default and set to true when calling _buildmap()  OK
+    
+    const BLSURFPlugin_Hypothesis::TAttractorMap class_attractors = BLSURFPlugin_Hypothesis::GetClassAttractorEntries(hyp);
+    int key=-1;
+    BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator AtIt = class_attractors.begin();
+    for ( ; AtIt != class_attractors.end(); ++AtIt ) {
+      if ( !AtIt->second->Empty() ) {
+       // MESSAGE("blsurf_set_attractor(): " << AtIt->first << " = " << AtIt->second);
+        GeomShape = entryToShape(AtIt->first);
+       AttShape = AtIt->second->GetAttractorShape();
+        GeomType  = GeomShape.ShapeType();
+        // Group Management
+//         if (GeomType == TopAbs_COMPOUND){
+//           for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
+//             if (it.Value().ShapeType() == TopAbs_FACE){
+//               HasAttractorOnFace = true;
+//               myAttractor = BLSURFPluginAttractor(GeomShape, AttShape);           
+//             }
+//           }
+//         }
+                
+        if (GeomType == TopAbs_FACE && (AttShape.ShapeType() == TopAbs_VERTEX || AttShape.ShapeType() == TopAbs_EDGE)){
+         HasSizeMapOnFace = true;
+         if (! FacesWithSizeMap.Contains(TopoDS::Face(GeomShape)) ) {
+                key = FacesWithSizeMap.Add(TopoDS::Face(GeomShape) );
+              }
+              else {
+                key = FacesWithSizeMap.FindIndex(TopoDS::Face(GeomShape));
+//                 MESSAGE("Face with key " << key << " already in map");
+              }
+              FaceId2ClassAttractor[key] = AtIt->second;
+        }
+        else{
+         MESSAGE("Wrong shape type !!")
+       }
 
+      }
+    }
+
+    
 
     //
     // Enforced Vertices
@@ -941,6 +1019,8 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
 
   FacesWithSizeMap.Clear();
   FaceId2SizeMap.clear();
+  FaceId2ClassAttractor.clear();
+  FaceIndex2ClassAttractor.clear();
   EdgesWithSizeMap.Clear();
   EdgeId2SizeMap.clear();
   VerticesWithSizeMap.Clear();
@@ -986,6 +1066,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
   string bad_end = "return";
   int faceKey = -1;
   int ienf = 0;
+  BLSURFPlugin_Attractor myAttractor;
   for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) {
     TopoDS_Face f=TopoDS::Face(face_iter.Current());
 
@@ -1019,11 +1100,14 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
     }
     
     if (HasSizeMapOnFace){
+//       MESSAGE("A size map is defined on a face")
 //       std::cout << "A size map is defined on a face" << std::endl;
       // Classic size map
       faceKey = FacesWithSizeMap.FindIndex(f);
       
+      
       if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end()){
+       MESSAGE("A size map is defined on face :"<<faceKey)
         theSizeMapStr = FaceId2SizeMap[faceKey];
         // check if function ends with "return"
         if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
@@ -1078,6 +1162,16 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
         }
       }
       
+      // Class Attractors
+      std::map<int,BLSURFPlugin_Attractor* >::iterator clAttractor_iter = FaceId2ClassAttractor.find(faceKey);
+      if (clAttractor_iter != FaceId2ClassAttractor.end()){
+          MESSAGE("Face indice: " << iface);
+          MESSAGE("Adding attractor");
+          FaceIndex2ClassAttractor[iface]=clAttractor_iter->second;
+          FaceId2ClassAttractor.erase(clAttractor_iter);
+        }
+      }     
+      
       // Enforced Vertices
       faceKey = FacesWithEnforcedVertices.FindIndex(f);
       std::map<int,BLSURFPlugin_Hypothesis::TEnfVertexCoordsList >::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey);
@@ -1138,7 +1232,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
       }
 //       else
 //         std::cout << "No enforced vertex defined" << std::endl;
-    }
+//     }
     
     
     /****************************************************************************************
@@ -1702,8 +1796,9 @@ status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data)
       my_v_max = uv[1];
     }
   }
-
+  //MESSAGE("size_on_surface")
   if (FaceId2PythonSmp.count(face_id) != 0){
+    //MESSAGE("A size map is used to calculate size on face : "<<face_id)
     PyObject * pyresult = NULL;
     PyObject* new_stderr = NULL;
     assert(Py_IsInitialized());
@@ -1726,11 +1821,20 @@ status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data)
       result = PyFloat_AsDouble(pyresult);
       Py_DECREF(pyresult);
     }
+   // MESSAGE("f(" << uv[0] << "," << uv[1] << ")" << " = " << result);
     *size = result;
-    //MESSAGE("f(" << uv[0] << "," << uv[1] << ")" << " = " << result);
     PyGILState_Release(gstate);
   }
+  else if (FaceIndex2ClassAttractor.count(face_id) !=0 && !FaceIndex2ClassAttractor[face_id]->Empty()){
+//    MESSAGE("attractor used on face :"<<face_id)
+    // MESSAGE("List of attractor is not empty")
+    // MESSAGE("Attractor empty : "<< FaceIndex2ClassAttractor[face_id]->Empty())
+    double result = FaceIndex2ClassAttractor[face_id]->GetSize(uv[0],uv[1]);
+    *size = result;
+   // MESSAGE("f(" << uv[0] << "," << uv[1] << ")" << " = " << result);
+  }
   else {
+    // MESSAGE("List of attractor is empty !!!")
     *size = *((double*)user_data);
   }
   return STATUS_OK;
index 734313bbf964c32bad10d36de6657b61ebd5e52d..83ddca1df22a1b3cb72c55e4353fd56960ce16b4 100644 (file)
 // ---
 //
 #include "BLSURFPlugin_Hypothesis.hxx"
+#include "BLSURFPlugin_Attractor.hxx"
+#include "SMESH_Gen_i.hxx"
 #include <utilities.h>
 #include <cstring>
 #include <iostream>
 #include <sstream>
 
+// cascade include
+#include "ShapeAnalysis.hxx"
+
+// CORBA includes
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(GEOM_Gen)
+
 //=============================================================================
 BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen) :
   SMESH_Hypothesis(hypId, studyId, gen), _topology(GetDefaultTopology()),
@@ -48,6 +57,7 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   _verb(GetDefaultVerbosity()),
   _sizeMap(GetDefaultSizeMap()),
   _attractors(GetDefaultSizeMap()),
+  _classAttractors(GetDefaultAttractorMap()),
   _faceEntryEnfVertexListMap(GetDefaultFaceEntryEnfVertexListMap()),
   _enfVertexList(GetDefaultEnfVertexList()),
   _faceEntryCoordsListMap(GetDefaultFaceEntryCoordsListMap()),
@@ -55,7 +65,6 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   _faceEntryEnfVertexEntryListMap(GetDefaultFaceEntryEnfVertexEntryListMap()),
   _enfVertexEntryEnfVertexMap(GetDefaultEnfVertexEntryEnfVertexMap()),
   _groupNameNodeIDMap(GetDefaultGroupNameNodeIDMap())
-
 /* TODO GROUPS
  _groupNameEnfVertexListMap(GetDefaultGroupNameEnfVertexListMap()),
  _enfVertexGroupNameMap(GetDefaultEnfVertexGroupNameMap())
@@ -111,6 +120,28 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
    */
 }
 
+TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry)
+{
+  MESSAGE("BLSURFPlugin_Hypothesis::entryToShape "<<entry );
+  GEOM::GEOM_Object_var aGeomObj;
+  SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
+  SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
+  
+  TopoDS_Shape S = TopoDS_Shape();
+  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+  SALOMEDS::GenericAttribute_var anAttr;
+
+  if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
+    SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+    CORBA::String_var aVal = anIOR->Value();
+    CORBA::Object_var obj = myStudy->ConvertIORToObject(aVal);
+    aGeomObj = GEOM::GEOM_Object::_narrow(obj);
+  }
+  if ( !aGeomObj->_is_nil() )
+    S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
+  return S;
+}
+
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetTopology(Topology theTopology) {
   if (theTopology != _topology) {
@@ -356,21 +387,113 @@ BLSURFPlugin_Hypothesis::TSizeMap BLSURFPlugin_Hypothesis::GetAttractorEntries(c
 }
 
 //=======================================================================
-//function : ClearEntry
+//function : SetClassAttractorEntry
 //=======================================================================
-void BLSURFPlugin_Hypothesis::ClearEntry(const std::string& entry) {
-  TSizeMap::iterator it = _sizeMap.find(entry);
-  if (it != _sizeMap.end()) {
+void BLSURFPlugin_Hypothesis::SetClassAttractorEntry(const std::string& entry, const std::string& attEntry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius)
+{
+  // The new attractor can't be defined on the same face as another sizemap
+  TSizeMap::iterator it  = _sizeMap.find( entry );
+  if ( it != _sizeMap.end() ) {
     _sizeMap.erase(it);
     NotifySubMeshesHypothesisModification();
-  } else {
-    TSizeMap::iterator itAt = _attractors.find(entry);
-    if (itAt != _attractors.end()) {
+  }
+  else {
+    TSizeMap::iterator itAt  = _attractors.find( entry );
+    if ( itAt != _attractors.end() ) {
       _attractors.erase(itAt);
       NotifySubMeshesHypothesisModification();
-    } else
-      std::cout << "No_Such_Entry" << std::endl;
+    }
+  }
+  
+  const TopoDS_Shape AttractorShape = BLSURFPlugin_Hypothesis::entryToShape(attEntry);
+  const TopoDS_Face FaceShape = TopoDS::Face(BLSURFPlugin_Hypothesis::entryToShape(entry));
+  bool attExists = (_classAttractors.find(entry) != _classAttractors.end());
+  double u1,u2,v1,v2, diag;
+  
+  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); 
+    myAttractor->BuildMap();
+    myAttractor->SetParameters(StartSize, EndSize, ActionRadius, ConstantRadius);
+    _classAttractors[entry] = myAttractor;
+    NotifySubMeshesHypothesisModification();
   }
+  else {
+    _classAttractors[entry]->SetParameters(StartSize, EndSize, ActionRadius, ConstantRadius);
+    if (!_classAttractors[entry]->IsMapBuilt()){
+      _classAttractors[entry]->BuildMap();
+    }
+    NotifySubMeshesHypothesisModification();
+  }
+    
+}
+
+//=======================================================================
+//function : SetConstantSizeOnAdjacentFaces
+//=======================================================================
+// TODO uncomment and test (include the needed .hxx)
+// SetConstantSizeOnAdjacentFaces(myShape, att_entry, startSize, endSize = user_size, const_dist  ) {
+//   TopTools_IndexedMapOfShapListOdShape anEdge2FaceMap;
+//   TopExp::MapShapesAnAncestors(myShape,TopAbs_EDGE, TopAbs_FACE, anEdge2FaceMap);
+//   TopTools_IndexedMapOfShapListOdShape::iterator it;
+//   for (it = anEdge2FaceMap.begin();it != anEdge2FaceMap.end();it++){
+//       SetClassAttractorEntry((*it).first, att_entry, startSize, endSize, 0, const_dist)
+//   }
+
+
+
+
+
+
+//=======================================================================
+//function : GetClassAttractorEntry
+//=======================================================================
+// BLSURFPlugin_Attractor&  BLSURFPlugin_Hypothesis::GetClassAttractorEntry(const std::string& entry)
+// {
+//  TAttractorMap::iterator it  = _classAttractors.find( entry );
+//  if ( it != _classAttractors.end() )
+//    return it->second;
+//  else
+//    return "No_Such_Entry";
+// }
+// 
+  /*!
+   * \brief Return the map of attractor instances
+   */
+BLSURFPlugin_Hypothesis::TAttractorMap BLSURFPlugin_Hypothesis::GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp)
+{
+    return hyp ? hyp->_GetClassAttractorEntries():GetDefaultAttractorMap();
+}
+
+//=======================================================================
+//function : ClearEntry
+//=======================================================================
+void BLSURFPlugin_Hypothesis::ClearEntry(const std::string& entry)
+{
+ TSizeMap::iterator it  = _sizeMap.find( entry );
+ if ( it != _sizeMap.end() ) {
+   _sizeMap.erase(it);
+   NotifySubMeshesHypothesisModification();
+ }
+ else {
+   TSizeMap::iterator itAt  = _attractors.find( entry );
+   if ( itAt != _attractors.end() ) {
+     _attractors.erase(itAt);
+     NotifySubMeshesHypothesisModification();
+   }
+   else {
+     TAttractorMap::iterator it_clAt = _classAttractors.find( entry );
+     if ( it_clAt != _classAttractors.end() ) {
+       _classAttractors.erase(it_clAt);
+       MESSAGE("_classAttractors.size() = "<<_classAttractors.size())
+       NotifySubMeshesHypothesisModification();
+     }
+     else
+       std::cout<<"No_Such_Entry"<<std::endl;
+   }
+ }
 }
 
 //=======================================================================
@@ -379,6 +502,7 @@ void BLSURFPlugin_Hypothesis::ClearEntry(const std::string& entry) {
 void BLSURFPlugin_Hypothesis::ClearSizeMaps() {
   _sizeMap.clear();
   _attractors.clear();
+  _classAttractors.clear();
 }
 
 //=======================================================================
@@ -823,6 +947,29 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
     }
     save << " " << "__ATTRACTORS_END__";
   }
+  
+  TAttractorMap::iterator it_At = _classAttractors.begin();
+  if (it_At != _classAttractors.end()) {
+    std::ostringstream test;
+    save << " " << "__NEW_ATTRACTORS_BEGIN__";
+    test << " " << "__NEW_ATTRACTORS_BEGIN__";
+    for (; it_At != _classAttractors.end(); ++it_At) {
+      std::vector<double> attParams;
+      attParams   = it_At->second->GetParameters();
+      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;
+      test << " " << it_At->first;
+      test << " " << it_At->second->GetAttractorEntry();
+      test << " " << attParams[0]  << " " <<  attParams[1] << " " <<  attParams[2] << " " <<  attParams[3];
+      test << " " << step;
+    }
+    save << " " << "__NEW_ATTRACTORS_END__";
+    test << " " << "__NEW_ATTRACTORS_END__";
+    MESSAGE(" Attractor hypothesis saved as "<<test.str())
+  }
 
   TEnfVertexList::const_iterator it_enf = _enfVertexList.begin();
   if (it_enf != _enfVertexList.end()) {
@@ -963,6 +1110,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
   bool hasOptions = false;
   bool hasSizeMap = false;
   bool hasAttractor = false;
+  bool hasNewAttractor = false;
   bool hasEnforcedVertex = false;
 
   isOK = (load >> option_or_sm);
@@ -973,6 +1121,8 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
       hasSizeMap = true;
     else if (option_or_sm == "__ATTRACTORS_BEGIN__")
       hasAttractor = true;
+    else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+      hasNewAttractor = true;
     else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
       hasEnforcedVertex = true;
 
@@ -1010,6 +1160,8 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
         hasSizeMap = true;
       else if (option_or_sm == "__ATTRACTORS_BEGIN__")
         hasAttractor = true;
+      else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+        hasNewAttractor = true;
       else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
         hasEnforcedVertex = true;
   }
@@ -1046,6 +1198,8 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     if (isOK)
       if (option_or_sm == "__ATTRACTORS_BEGIN__")
         hasAttractor = true;
+      if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+        hasNewAttractor = true;
       else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
         hasEnforcedVertex = true;
   }
@@ -1080,7 +1234,9 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
   if (hasAttractor) {
     isOK = (load >> option_or_sm);
     if (isOK)
-      if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
+      if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+        hasNewAttractor = true;
+      else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
         hasEnforcedVertex = true;
   }
 
index 28c6911ce38f1c07445cb5115fee4a6a49039414..7b40c9dcc089fa50a2b5affdce2c5481447ba550 100644 (file)
@@ -36,6 +36,7 @@
 #include <cstring>
 #include <sstream>
 #include <utilities.h>
+#include "BLSURFPlugin_Attractor.hxx"
 
 //  Parameters for work of BLSURF
 
@@ -59,6 +60,8 @@ public:
     DefaultGeom,
     UserDefined
   };
+  
+  TopoDS_Shape entryToShape(std::string entry);
 
   void SetTopology(Topology theTopology);
   Topology GetTopology() const { return _topology; }
@@ -131,16 +134,27 @@ public:
   void UnsetCustomSizeMap(const std::string& entry);
   const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
  */
+  
+  typedef std::map< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
+  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir 
+  
+  void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
+  std::string  GetClassAttractorEntry(const std::string& entry);
+  const TAttractorMap& _GetClassAttractorEntries() const { return _classAttractors; }
+  /*!
+   * \brief Return the attractors entries
+   */
+  static TAttractorMap GetClassAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
 
   /*!
    * To set/get/unset an enforced vertex
    */
+  // Name
+  typedef std::string TEnfName;
   // Entry
   typedef std::string TEntry;
   // List of entries
   typedef std::set<TEntry> TEntryList;
-  // Name
-  typedef std::string TEnfName;
   // Group name
   typedef std::string TEnfGroupName;
   // Coordinates
@@ -260,6 +274,7 @@ public:
   static bool            GetDefaultDecimesh();
   static int             GetDefaultVerbosity() { return 10; }
   static TSizeMap        GetDefaultSizeMap() { return TSizeMap();}
+  static TAttractorMap   GetDefaultAttractorMap() { return TAttractorMap(); }
 
   static TFaceEntryEnfVertexListMap       GetDefaultFaceEntryEnfVertexListMap() { return TFaceEntryEnfVertexListMap(); }
   static TEnfVertexList                   GetDefaultEnfVertexList() { return TEnfVertexList(); }
@@ -320,6 +335,9 @@ private:
   TOptionNames    _doubleOptions, _charOptions;
   TSizeMap        _sizeMap;
   TSizeMap        _attractors;
+  TAttractorMap   _classAttractors;
+  TSizeMap        _attEntry;
+  TParamsMap      _attParams;
 
   TFaceEntryEnfVertexListMap  _faceEntryEnfVertexListMap;
   TEnfVertexList              _enfVertexList;
index 2488854a34fa4d7967b89a37f58b8d20b791fd00..5bb3c12a4ed73735e8ce287916d77d9c6c1e52dd 100644 (file)
@@ -498,7 +498,6 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char*
   try {
     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
     if ( valueChanged ) {
-      //boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)\\)$");
       boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
       if (!boost::regex_match(string(attractor), re))
         throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
@@ -521,6 +520,33 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char*
 
 //=============================================================================
 
+void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) //TODO à finir
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
+  bool valueChanged = false;
+  try {
+    this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
+  }
+  catch (const std::invalid_argument& ex) {
+    SALOME::ExceptionStruct ExDescription;
+    ExDescription.text = ex.what();
+    ExDescription.type = SALOME::BAD_PARAM;
+    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
+    ExDescription.lineNumber = 0;
+    throw SALOME::SALOME_Exception(ExDescription);
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+  MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
+  //if ( valueChanged )
+  SMESH::TPythonDump() << _this() << ".SetAttractorGeom("
+                       << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
+}
+
+//=============================================================================
+
 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   try {
@@ -557,6 +583,31 @@ char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SAL
   return 0;
 }
 
+// //=============================================================================
+// 
+// // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
+// // A finir pour le dump
+// char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
+//   throw (SALOME::SALOME_Exception)
+// {
+//   ASSERT(myBaseImpl);
+//   try {
+//     return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
+//   }
+//   catch (const std::invalid_argument& ex) {
+//     SALOME::ExceptionStruct ExDescription;
+//     ExDescription.text = ex.what();
+//     ExDescription.type = SALOME::BAD_PARAM;
+//     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
+//     ExDescription.lineNumber = 0;
+//     throw SALOME::SALOME_Exception(ExDescription);
+//   }
+//   catch (SALOME_Exception& ex) {
+//     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+//   }
+//   return 0;
+// }
+
 //=============================================================================
 
 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
@@ -609,6 +660,42 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
 
 //=============================================================================
 
+BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
+{
+  ASSERT(myBaseImpl);
+  BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
+
+  const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
+  result->length( attractors.size() );
+
+  ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
+  for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
+    string faceEntry = atIt->first;
+    string attEntry;
+    double startSize, endSize, infDist, constDist;
+    if ( !atIt->second->Empty() ) {
+      attEntry = atIt->second->GetAttractorEntry();
+      MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
+      std::vector<double> params = atIt->second->GetParameters();
+      startSize = params[0];
+      endSize = params[1];
+      infDist = params[2];
+      constDist = params[3];
+    }
+    result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
+    result[i].attEntry = CORBA::string_dup(attEntry.c_str());
+    result[i].startSize = startSize;
+    result[i].endSize = endSize;
+    result[i].infDist = infDist;
+    result[i].constDist = constDist;
+    MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
+    MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
+  }
+  return result._retn();
+}
+
+//=============================================================================
+
 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
@@ -675,6 +762,31 @@ void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
 }
 
+void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, double StartSize, double EndSize, double ActionRadius, double ConstantRadius)
+{
+  ASSERT(myBaseImpl);
+  string entry;
+  string att_entry;
+  entry=GeomObj->GetStudyEntry();
+  att_entry=Attractor->GetStudyEntry();
+  TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( GeomObj ));
+  TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( Attractor );
+  MESSAGE("IDL : GetName : " << GeomObj->GetName());
+  MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
+  SetClassAttractorEntry( entry.c_str(), att_entry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
+}
+
+void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj)
+{
+  ASSERT(myBaseImpl);
+  string entry;
+  entry = GeomObj->GetStudyEntry();
+  MESSAGE("IDL : GetName : " << GeomObj->GetName());
+  MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
+  UnsetEntry( entry.c_str());
+  SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " << entry.c_str() << " )";
+}
+
 /*
  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
  {}
index 6de292d3bfb901779f1c3b2ce47531785413cd27..85c62007255d4adbe15348e8265c5a723878c032 100644 (file)
@@ -121,6 +121,20 @@ public:
   char* GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception);
 
   BLSURFPlugin::string_array* GetAttractorEntries();
+  
+  
+  /*!
+    * Set/get/unset an attractor on a face 
+    */
+  
+  void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, double StartSize, double EndSize, double ActionRadius, double ConstantRadius );
+
+  void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj);
+
+  void SetClassAttractorEntry(const char* entry, const char* att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius)  throw (SALOME::SALOME_Exception);
+
+  BLSURFPlugin::TAttParamsMap* GetAttractorParams();
+  
 
   /*
    void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
index 5be9a3fbe651ac8a806bba528b1fee642d7460f5..e0c37eba131f38f90ddb3b0f688963fd52a97459 100644 (file)
@@ -29,7 +29,8 @@ salomeinclude_HEADERS =       \
        BLSURFPlugin_BLSURF.hxx \
        BLSURFPlugin_BLSURF_i.hxx       \
        BLSURFPlugin_Hypothesis.hxx     \
-       BLSURFPlugin_Hypothesis_i.hxx
+       BLSURFPlugin_Hypothesis_i.hxx   \
+       BLSURFPlugin_Attractor.hxx
 
 # Libraries targets
 lib_LTLIBRARIES = libBLSURFEngine.la
@@ -39,7 +40,8 @@ dist_libBLSURFEngine_la_SOURCES =     \
        BLSURFPlugin_BLSURF_i.cxx       \
        BLSURFPlugin_Hypothesis.cxx     \
        BLSURFPlugin_Hypothesis_i.cxx   \
-       BLSURFPlugin_i.cxx
+       BLSURFPlugin_i.cxx              \
+       BLSURFPlugin_Attractor.cxx
 
 libBLSURFEngine_la_CPPFLAGS =  \
        $(QT_INCLUDES)          \
index 12951a8a9aec5caaea0691f32495301a87aaa92d..75df8601fa2c07464d093d84e19d28890b2d02d6 100644 (file)
@@ -40,6 +40,7 @@
 #include <SUIT_ResourceMgr.h>
 #include <SalomeApp_Tools.h>
 
+#include <QObject>
 #include <QComboBox>
 #include <QLabel>
 #include <QGroupBox>
@@ -107,9 +108,10 @@ enum {
   OPTION_NAME_COLUMN,
   OPTION_VALUE_COLUMN,
   NB_COLUMNS,
-  SMP_ENTRY_COLUMN = 0,
-  SMP_NAME_COLUMN,
+  SMP_NAME_COLUMN =0,
   SMP_SIZEMAP_COLUMN,
+  SMP_ENTRY_COLUMN,
+//  SMP_DIST_COLUMN,
   SMP_NB_COLUMNS,
 // Enforced vertices array columns
   ENF_VER_NAME_COLUMN = 0,
@@ -123,15 +125,26 @@ enum {
 };
 
 enum {
-  SMP_BTNS = 0,
-//   SMP_ATTRACTOR_BTN,
-//   SMP_SEPARATOR1,
-  SMP_POINT_BTN,
-  SMP_EDGE_BTN,
-  SMP_SURFACE_BTN,
-  SMP_SEPARATOR2,
-  SMP_REMOVE_BTN,
-  SMP_NB_LINES
+  SMP_TAB_WDG,
+  SMP_ADD_BTN,
+  SMP_NB_LINES,
+  SMP_STD_TAB = 0,
+  ATT_TAB,
+  SMP_GEOM_BTN_2 = 0,
+  ATT_CHECK,
+  CONST_SIZE_CHECK,
+  SMP_SPACE,
+  SMP_PARAMS,
+  SMP_ATT_SHAPE = 0, 
+  SMP_ATT_SIZE,
+  SMP_ATT_DIST,
+  SMP_ATT_RAD
+};
+  
+enum {
+  SMP_GEOM_BTN_1,
+  SMP_SIZE,
+  SMP_SPACE2,
 };
 
 // Enforced vertices inputs
@@ -142,6 +155,7 @@ enum {
   ENF_VER_Y_COORD,
   ENF_VER_Z_COORD,
   ENF_VER_GROUP,
+  ENF_VER_SPACE,
   ENF_VER_VERTEX_BTN,
   ENF_VER_REMOVE_BTN,
 //   ENF_VER_SEPARATOR,
@@ -589,11 +603,12 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams() const
     BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() );
     BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
 
-    int row = 0, nbRows = mySizeMapTable->rowCount();
+//     int row = 0, nbRows = mySizeMapTable->rowCount();
+    int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
     for ( ; row < nbRows; ++row )
     {
-      QString entry   = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
-      QString sizeMap = mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->text().trimmed();
+      QString entry   = mySizeMapTable->topLevelItem( row )->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
+      QString sizeMap = mySizeMapTable->topLevelItem( row )->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
       if ( !sizeMap.isEmpty() ) {
         if (that->sizeMapValidationFromRow(row))
         {
@@ -628,7 +643,9 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   MESSAGE("BLSURFPluginGUI_HypothesisCreator::buildFrame");
 
   QFrame* fr = new QFrame( 0 );
+ // fr-> setMinimumSize(600,400);
   QVBoxLayout* lay = new QVBoxLayout( fr );
+ // lay->setSizeConstraint(QLayout::SetDefaultConstraint);
   lay->setMargin( 5 );
   lay->setSpacing( 0 );
 
@@ -769,43 +786,127 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   // Size Maps parameters
 
   mySmpGroup = new QWidget();
-  QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
+//   mySmpGroup->setMinimumWidth(500);
 
-  mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup );
+  //Layout
+  QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
+  
+  // Table
+  mySizeMapTable = new QTreeWidget( mySmpGroup );
+  mySizeMapTable ->setMinimumWidth(250);
   QStringList sizeMapHeaders;
-  sizeMapHeaders << tr( "SMP_ENTRY_COLUMN" )<< tr( "SMP_NAME_COLUMN" ) << tr( "SMP_SIZEMAP_COLUMN" );
-  mySizeMapTable->setHorizontalHeaderLabels(sizeMapHeaders);
-  mySizeMapTable->horizontalHeader()->hideSection( SMP_ENTRY_COLUMN );
-  mySizeMapTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+  sizeMapHeaders << tr( "SMP_NAME_COLUMN" )<< tr( "SMP_SIZEMAP_COLUMN" )<< tr( "SMP_ENTRY_COLUMN" );// << tr( "SMP_DIST_COLUMN" );
+  mySizeMapTable->setHeaderLabels(sizeMapHeaders);
   mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
   mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
+  mySizeMapTable->hideColumn(SMP_ENTRY_COLUMN);
   mySizeMapTable->setAlternatingRowColors(true);
-  mySizeMapTable->verticalHeader()->hide();
-/*
-  addAttractorButton = new QPushButton(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup);
-  QFrame *line = new QFrame(mySmpGroup);
-  line->setFrameShape(QFrame::HLine);
-  line->setFrameShadow(QFrame::Sunken);
-*/
-  addSurfaceButton = new QPushButton(tr("BLSURF_SM_SURFACE"),mySmpGroup);
-  addEdgeButton = new QPushButton(tr("BLSURF_SM_EDGE"),mySmpGroup);
-  addPointButton = new QPushButton(tr("BLSURF_SM_POINT"),mySmpGroup);
-  QFrame *line2 = new QFrame(mySmpGroup);
-  line2->setFrameShape(QFrame::HLine);
-  line2->setFrameShadow(QFrame::Sunken);
-  removeButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup);
-
+  
+  // tab widget
+  smpTab = new QTabWidget( mySmpGroup );
+  smpTab->setTabShape( QTabWidget::Rounded );
+  smpTab->setTabPosition( QTabWidget::East );
+  lay->addWidget( smpTab );
+  
+  // Push buttons
+  removeMapButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup);
+  addMapButton = new QPushButton(tr("BLSURF_SM_ADD"),mySmpGroup);
+  modifyMapButton = new QPushButton(tr("BLSURF_SM_MODIFY"),mySmpGroup);
+  modifyMapButton->setEnabled(false);
+  
+  // Filters of selection
+  TColStd_MapOfInteger SM_ShapeTypes, ATT_ShapeTypes;
+  
+  SM_ShapeTypes.Add( TopAbs_VERTEX );
+  SM_ShapeTypes.Add( TopAbs_EDGE );
+  SM_ShapeTypes.Add( TopAbs_FACE );
+  
+  ATT_ShapeTypes.Add( TopAbs_VERTEX );
+  ATT_ShapeTypes.Add( TopAbs_EDGE );
+  
+  SMESH_NumberFilter* myFilter1 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, SM_ShapeTypes);
+  SMESH_NumberFilter* myFilter2 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, ATT_ShapeTypes);
+  SMESH_NumberFilter* myFilter3 = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, TopAbs_FACE);
+  
+  // Geometry Selection Widgets 
+  myGeomSelWdg1 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter1, 0, /*multiSel=*/false,/*stretch=*/false);
+  myGeomSelWdg1->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
+  myGeomSelWdg2 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter3, 0, /*multiSel=*/false,/*stretch=*/false);
+  myGeomSelWdg2->SetDefaultText(tr("BLS_SEL_FACE"), "QLineEdit { color: grey }");// TODO ajouter aux fichiers de traduction
+  
+  myGeomSelWdg1->AvoidSimultaneousSelection(myGeomSelWdg2);
+  
+  // Attractor tab
+  myAttractorGroup = new QWidget();
+  QGridLayout* anAttLayout = new QGridLayout(myAttractorGroup);
+  myAttractorCheck = new QCheckBox(tr("BLSURF_ATTRACTOR"),myAttractorGroup);
+  myConstSizeCheck = new QCheckBox(tr("BLSURF_CONST_SIZE"),myAttractorGroup);
+  myParamsGroup = new QGroupBox(tr("BLSURF_SM_PARAMS"), myAttractorGroup);
+  myParamsGroup->setEnabled(false);
+  QGridLayout* aParamsLayout = new QGridLayout(myParamsGroup);
+  myAttDistSpin = new SMESHGUI_SpinBox(myParamsGroup);
+  myAttDistSpin->RangeStepAndValidator(0., COORD_MAX, 10.0, "length_precision");
+  myAttDistSpin2 = new SMESHGUI_SpinBox(myParamsGroup);
+  myAttDistSpin2->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
+  myAttSizeSpin = new SMESHGUI_SpinBox(myParamsGroup);
+  myAttSizeSpin->RangeStepAndValidator(0., COORD_MAX, 1.0, "length_precision");
+  myAttDistLabel = new QLabel(tr("BLSURF_ATT_DIST"),myParamsGroup);
+  myAttDistLabel2 = new QLabel(tr("BLSURF_ATT_RADIUS"),myParamsGroup);
+  myAttSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),myParamsGroup);
+  myAttSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter2, myParamsGroup, /*multiSel=*/false,/*stretch=*/false);
+  myAttSelWdg->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }"); // TODO ajouter aux fichiers de traduction
+  
+  myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg1);
+  myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg2);
+  
+  // Standard size map tab
+  mySmpStdGroup = new QWidget();
+  QGridLayout* anSmpStdLayout = new QGridLayout(mySmpStdGroup);
+  mySmpSizeSpin = new SMESHGUI_SpinBox(mySmpStdGroup);
+  mySmpSizeSpin->RangeStepAndValidator(0., COORD_MAX, 10.0, "length_precision");
+  QLabel* mySmpSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),mySmpStdGroup);
+  
+  // Init SpinBoxes
+  myAttDistSpin->setValue(0.);
+  myAttDistSpin2->setValue(0.);
+  myAttSizeSpin->setValue(0.);
+  mySmpSizeSpin->setValue(0.);
 
+  
   // ADD WIDGETS (SIZEMAP TAB)
-  anSmpLayout->addWidget(mySizeMapTable,     SMP_POINT_BTN, 0, SMP_NB_LINES+1, 1);
-//   anSmpLayout->addWidget(addAttractorButton, SMP_ATTRACTOR_BTN, 1, 1, 1);
-//   anSmpLayout->addWidget(line,               SMP_SEPARATOR1, 1, 1, 1);
-  anSmpLayout->addWidget(addPointButton,     SMP_POINT_BTN, 1, 1, 1);
-  anSmpLayout->addWidget(addEdgeButton,      SMP_EDGE_BTN, 1, 1, 1);
-  anSmpLayout->addWidget(addSurfaceButton,   SMP_SURFACE_BTN, 1, 1, 1);
-  anSmpLayout->addWidget(line2,              SMP_SEPARATOR2, 1, 1, 1);
-  anSmpLayout->addWidget(removeButton,       SMP_REMOVE_BTN, 1, 1, 1);
+  anSmpLayout->addWidget(mySizeMapTable,     0,  0, SMP_NB_LINES, 1);
+  anSmpLayout->setColumnStretch(0, 1);
+//  anSmpLayout->addWidget(line2,              SMP_SEPARATOR2, 1, 2, 2);
+  anSmpLayout->addWidget(smpTab,             SMP_TAB_WDG,     1, 1, 3);
+  anSmpLayout->setRowStretch(SMP_TAB_WDG, 1);
+  anSmpLayout->addWidget(addMapButton,       SMP_ADD_BTN,     1, 1, 1);
+  anSmpLayout->addWidget(removeMapButton,    SMP_ADD_BTN,     2, 1, 1);
+  anSmpLayout->addWidget(modifyMapButton,    SMP_ADD_BTN,     3, 1, 1);
+  
+  // STANDARD TAB
+  anSmpStdLayout->addWidget(myGeomSelWdg1,   SMP_GEOM_BTN_1,  1, 1, 2);
+  anSmpStdLayout->addWidget(mySmpSizeLabel,  SMP_SIZE,        1, 1, 1);
+  anSmpStdLayout->addWidget(mySmpSizeSpin,   SMP_SIZE,        2, 1, 1);
+  anSmpStdLayout->setRowStretch(SMP_SPACE2, 1);
+  
+  //ADVANCED TAB
+  anAttLayout->addWidget(myGeomSelWdg2,      SMP_GEOM_BTN_2,  1, 1, 2);
+  anAttLayout->addWidget(myAttractorCheck,   ATT_CHECK,       1, 1, 2);
+  anAttLayout->addWidget(myConstSizeCheck,   CONST_SIZE_CHECK,1, 1, 2);
+  anAttLayout->addWidget(myParamsGroup,      SMP_PARAMS,      1, 1, 2);
+  aParamsLayout->addWidget(myAttSelWdg,      SMP_ATT_SHAPE,   1, 1, 2);
+  aParamsLayout->addWidget(myAttSizeLabel,   SMP_ATT_SIZE,    1, 1, 1);
+  aParamsLayout->addWidget(myAttSizeSpin,    SMP_ATT_SIZE,    2, 1, 1);
+  aParamsLayout->addWidget(myAttDistLabel,   SMP_ATT_DIST,    1, 1, 1);
+  aParamsLayout->addWidget(myAttDistSpin,    SMP_ATT_DIST,    2, 1, 1);
+  aParamsLayout->addWidget(myAttDistLabel2,  SMP_ATT_RAD,     1, 1, 1);
+  aParamsLayout->addWidget(myAttDistSpin2,   SMP_ATT_RAD,     2, 1, 1);
+  aParamsLayout->setRowStretch(SMP_ATT_RAD+1, 1);
+  
+  smpTab->insertTab( SMP_STD_TAB, mySmpStdGroup, tr( "BLSURF_SM_STD_TAB" ) );
+  smpTab->insertTab( ATT_TAB, myAttractorGroup, tr( "BLSURF_SM_ATT_TAB" ) );
 
+  smpTab->setCurrentIndex( SMP_STD_TAB ); 
 
   // Enforced vertices parameters
   myEnfGroup = new QWidget();
@@ -846,11 +947,11 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   shapeTypes2.Add( TopAbs_COMPOUND );
 
   SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
-  myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
+  myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true, /*stretch=*/false);
   myEnfFaceWdg->SetDefaultText("Select Faces", "QLineEdit { color: grey }");
 
   SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2);
-  myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
+  myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
   myEnfVertexWdg->SetDefaultText("Select Vertices", "QLineEdit { color: grey }");
 
   myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
@@ -898,6 +999,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   anEnfLayout2->addWidget(myZCoord,                 ENF_VER_Z_COORD, 1, 1, 1);
   anEnfLayout2->addWidget(myGroupNameLabel,         ENF_VER_GROUP, 0, 1, 1);
   anEnfLayout2->addWidget(myGroupName,              ENF_VER_GROUP, 1, 1, 1);
+  anEnfLayout2->setRowStretch(                      ENF_VER_SPACE, 1);
   anEnfLayout2->addWidget(addVertexButton,          ENF_VER_VERTEX_BTN, 0, 1, 2);
   anEnfLayout2->addWidget(removeVertexButton,       ENF_VER_REMOVE_BTN, 0, 1, 2);
 //   anEnfLayout->addWidget(line,                     ENF_VER_SEPARATOR, 0, 1, 2);
@@ -913,27 +1015,47 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   tab->setCurrentIndex( STD_TAB );
 
   // ---
-  connect( myGeometricMesh,    SIGNAL( activated( int ) ),            this,         SLOT( onGeometricMeshChanged() ) );
-  connect( myPhysicalMesh,     SIGNAL( activated( int ) ),            this,         SLOT( onPhysicalMeshChanged() ) );
-  connect( addBtn->menu(),     SIGNAL( aboutToShow() ),               this,         SLOT( onAddOption() ) );
-  connect( addBtn->menu(),     SIGNAL( triggered( QAction* ) ),       this,         SLOT( onOptionChosenInPopup( QAction* ) ) );
-  connect( rmBtn,              SIGNAL( clicked()),                    this,         SLOT( onDeleteOption() ) );
-
-  connect( addSurfaceButton,   SIGNAL( clicked()),                    this,         SLOT( onAddMapOnSurface() ) );
-  connect( addEdgeButton,      SIGNAL( clicked()),                    this,         SLOT( onAddMapOnEdge() ) );
-  connect( addPointButton,     SIGNAL( clicked()),                    this,         SLOT( onAddMapOnPoint() ) );
-  connect( removeButton,       SIGNAL( clicked()),                    this,         SLOT( onRemoveMap() ) );
-  connect( mySizeMapTable,     SIGNAL( cellChanged ( int, int  )),    this,         SLOT( onSetSizeMap(int,int ) ) );
-
-  connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) );
-  connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
-  connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ),     this,         SLOT( synchronizeCoords() ) );
-  connect( addVertexButton,    SIGNAL( clicked()),                    this,         SLOT( onAddEnforcedVertices() ) );
-  connect( removeVertexButton, SIGNAL( clicked()),                    this,         SLOT( onRemoveEnforcedVertex() ) );
-  connect( myEnfVertexWdg,     SIGNAL( contentModified()),            this,         SLOT( onSelectEnforcedVertex() ) );
+  connect( myGeometricMesh,     SIGNAL( activated( int ) ),            this,         SLOT( onGeometricMeshChanged() ) );
+  connect( myPhysicalMesh,      SIGNAL( activated( int ) ),            this,         SLOT( onPhysicalMeshChanged() ) );
+  connect( addBtn->menu(),      SIGNAL( aboutToShow() ),               this,         SLOT( onAddOption() ) );
+  connect( addBtn->menu(),      SIGNAL( triggered( QAction* ) ),       this,         SLOT( onOptionChosenInPopup( QAction* ) ) );
+  connect( rmBtn,               SIGNAL( clicked()),                    this,         SLOT( onDeleteOption() ) );
+
+  connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this,  SLOT( synchronizeCoords() ) );
+  connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this,  SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
+  connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ),      this,         SLOT( synchronizeCoords() ) );
+  connect( addVertexButton,     SIGNAL( clicked()),                    this,         SLOT( onAddEnforcedVertices() ) );
+  connect( removeVertexButton,  SIGNAL( clicked()),                    this,         SLOT( onRemoveEnforcedVertex() ) );
+  connect( myEnfVertexWdg,      SIGNAL( contentModified()),            this,         SLOT( onSelectEnforcedVertex() ) );
 //   connect( myEnfVertexWdg,     SIGNAL( selectionActivated()),         this,         SLOT( onVertexSelectionActivated() ) );
 //   connect( myEnfFaceWdg,       SIGNAL( selectionActivated()),         this,         SLOT( onFaceSelectionActivated() ) );
 //   connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(deactivateSelection(QWidget*, QWidget*)));
+  connect( myGeometricMesh,     SIGNAL( activated( int ) ),            this,         SLOT( onGeometricMeshChanged() ) );
+  connect( myPhysicalMesh,      SIGNAL( activated( int ) ),            this,         SLOT( onPhysicalMeshChanged() ) );
+  connect( addBtn->menu(),      SIGNAL( aboutToShow() ),               this,         SLOT( onAddOption() ) );
+  connect( addBtn->menu(),      SIGNAL( triggered( QAction* ) ),       this,         SLOT( onOptionChosenInPopup( QAction* ) ) );
+  connect( rmBtn,               SIGNAL( clicked()),                    this,         SLOT( onDeleteOption() ) );
+  // Size Maps
+  connect( addMapButton,        SIGNAL( clicked()),                    this,         SLOT( onAddMap() ) );
+  connect( removeMapButton,     SIGNAL( clicked()),                    this,         SLOT( onRemoveMap() ) );
+  connect( modifyMapButton,     SIGNAL( clicked()),                    this,         SLOT( onModifyMap() ) );
+  connect( mySizeMapTable,      SIGNAL( cellChanged ( int, int  )),    this,         SLOT( onSetSizeMap(int,int ) ) );
+  connect( mySizeMapTable,      SIGNAL( itemClicked (QTreeWidgetItem *, int)),this,  SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
+  connect( myGeomSelWdg2,       SIGNAL( contentModified() ),           this,         SLOT( onMapGeomContentModified() ) );
+  connect( myGeomSelWdg1,       SIGNAL( contentModified() ),           this,         SLOT( onMapGeomContentModified() ) );
+  connect( myAttractorGroup,    SIGNAL( clicked(bool) ),               this,         SLOT( onAttractorGroupClicked(bool) ) );
+  connect( mySizeMapTable,      SIGNAL( itemChanged (QTreeWidgetItem *, int)),this,  SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
+  connect( myAttractorCheck,    SIGNAL( stateChanged ( int )),         this,         SLOT( onAttractorClicked( int ) ) );
+  connect( myConstSizeCheck,    SIGNAL( stateChanged ( int )),         this,         SLOT( onConstSizeClicked( int ) ) );
+  connect( smpTab,              SIGNAL( currentChanged ( int )),       this,         SLOT( onSmpTabChanged( int ) ) );
+
+  // Enforced vertices
+  connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this,  SLOT( synchronizeCoords() ) );
+  connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this,  SLOT( update(QTreeWidgetItem *, int) ) );
+  connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ),      this,         SLOT( synchronizeCoords() ) );
+  connect( addVertexButton,     SIGNAL( clicked()),                    this,         SLOT( onAddEnforcedVertices() ) );
+  connect( removeVertexButton,  SIGNAL( clicked()),                    this,         SLOT( onRemoveEnforcedVertex() ) );
+  connect( myEnfVertexWdg,      SIGNAL( contentModified()),            this,         SLOT( onSelectEnforcedVertex() ) );
 
   return fr;
 }
@@ -1384,26 +1506,62 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
   myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
 
   // Sizemaps
-//   MESSAGE("retrieveParams():that->mySMPMap.size() = " << that->mySMPMap.size());
+  MESSAGE("retrieveParams():that->mySMPMap.size() = " << that->mySMPMap.size());
   QMapIterator<QString, QString> i(that->mySMPMap);
   GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
   while (i.hasNext()) {
     i.next();
     const QString entry = i.key();
-    string shapeName = myGeomToolSelected->getNameFromEntry(entry.toStdString());
+    string shapeName = myGeomToolSelected->getNameFromEntry(entry.toStdString()); 
     const QString sizeMap = i.value();
-    int row = mySizeMapTable->rowCount();
-    mySizeMapTable->setRowCount( row+1 );
-    mySizeMapTable->setItem( row, SMP_ENTRY_COLUMN, new QTableWidgetItem( entry ) );
-    mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->setFlags( 0 );
-    mySizeMapTable->setItem( row, SMP_NAME_COLUMN, new QTableWidgetItem( QString::fromStdString(shapeName) ) );
-    mySizeMapTable->item( row, SMP_NAME_COLUMN )->setFlags( 0 );
-    mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( sizeMap ) );
-    mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |
-                                                               Qt::ItemIsEditable   |
-                                                               Qt::ItemIsEnabled );
+    int row = mySizeMapTable->topLevelItemCount();
+//     mySizeMapTable->setRowCount( row+1 );
+    QTreeWidgetItem* item = new QTreeWidgetItem();
+    mySizeMapTable->addTopLevelItem( item ); 
+    item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
+    item->setData(SMP_ENTRY_COLUMN,Qt::DisplayRole, QVariant(entry) );
+    item->setData(SMP_NAME_COLUMN, Qt::DisplayRole, QVariant( QString::fromStdString(shapeName) ) );
+    if (that->myATTMap.contains(entry)){
+      const QString attEntry = that->myATTMap[entry];
+      std::string attName = myGeomToolSelected->getNameFromEntry(attEntry.toStdString());
+      QTreeWidgetItem* child = new QTreeWidgetItem();
+      item->addChild( child );
+      item->setExpanded(true);
+      child->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap  ) );
+      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 );*/                                                         
+      }
+      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 ); 
+      }
     }
-
+    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 );
   mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
 
@@ -1505,6 +1663,9 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
   that->myOptions = h->GetOptionValues();
 
   that->mySMPMap.clear();
+  that->myATTMap.clear();
+  that->myAttDistMap.clear();
+  that->myDistMap.clear();
 
   // classic size maps
   BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries();
@@ -1564,7 +1725,26 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
 //       MESSAGE("mySMPShapeTypeMap[" << myAttractorList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[myAttractorList[0]]);
     }
   }
-
+  
+  // attractor new version
+  MESSAGE("retriveParams, Attractors")
+  BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
+  for ( int i = 0;i<allMyAttractorParams->length(); ++i ) {
+    BLSURFPlugin::TAttractorParams myAttractorParams =  allMyAttractorParams[i];
+    QString faceEntry = myAttractorParams.faceEntry.in();
+    QString attEntry  = myAttractorParams.attEntry.in();
+    MESSAGE("attEntry = "<<attEntry.toStdString())
+    double  startSize = myAttractorParams.startSize;
+    double  endSize   = myAttractorParams.endSize;
+    double  infDist   = myAttractorParams.infDist;
+    double  constDist = myAttractorParams.constDist;
+    that->mySMPMap[faceEntry] = QString::number( startSize, 'g',  6 ); // TODO utiliser les préférences ici (cf. sketcher)
+    that->mySMPShapeTypeMap[faceEntry] = myGeomToolSelected->entryToShapeType(faceEntry.toStdString());
+    that->myATTMap[faceEntry] = attEntry;
+    that->myAttDistMap[faceEntry] = infDist;
+    that->myDistMap[faceEntry] = constDist;
+  }
+  
   // Enforced vertices
   h_data.enfVertexList.clear();
   h_data.faceEntryEnfVertexListMap.clear();
@@ -1666,36 +1846,43 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
 
     BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
     QMapIterator<QString,QString> i(that->mySMPMap);
-    // Iterate over each size map
     while (i.hasNext()) {
       i.next();
       const QString entry = i.key();
       const QString sizeMap = i.value();
 
       if (sizeMap == "__TO_DELETE__") {
-//         MESSAGE("Delete entry " << entry.toStdString() << " from engine");
+        MESSAGE("Delete entry " << entry.toStdString() << " from engine");
         h->UnsetEntry(entry.toLatin1().constData());
       }
       else if (sizeMap.startsWith("ATTRACTOR")) {
 //         MESSAGE("SetAttractorEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
-        h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
+        h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
       }
       else if (sizeMap.startsWith("def")) {
 //         MESSAGE("SetCustomSizeMapEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
 //        h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
       }
       else {
-        QString fullSizeMap;
-        fullSizeMap = QString("");
-        if (that->mySMPShapeTypeMap[entry]  == TopAbs_FACE)
-          fullSizeMap = QString("def f(u,v): return ") + sizeMap;
-        else if (that->mySMPShapeTypeMap[entry]  == TopAbs_EDGE)
-          fullSizeMap = QString("def f(t): return ") + sizeMap;
-        else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX)
-          fullSizeMap = QString("def f(): return ") + sizeMap;
-
-//         MESSAGE("SetSizeMapEntry("<<entry.toStdString()<<") = " <<fullSizeMap.toStdString());
-        h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
+       if (!myATTMap[entry].isEmpty()){
+         QString att_entry = myATTMap[entry];
+         double infDist = myAttDistMap[entry];
+         double constDist = myDistMap[entry];
+         double phySize = h->GetPhySize();
+         h->SetClassAttractorEntry( entry.toLatin1().constData(), att_entry.toLatin1().constData(), sizeMap.toDouble() , phySize, infDist, constDist );        
+       }
+        else {
+         QString fullSizeMap;
+         fullSizeMap = QString("");
+         if (that->mySMPShapeTypeMap[entry]  == TopAbs_FACE)
+           fullSizeMap = QString("def f(u,v): return ") + sizeMap;
+         else if (that->mySMPShapeTypeMap[entry]  == TopAbs_EDGE)
+           fullSizeMap = QString("def f(t): return ") + sizeMap;
+         else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX)
+           fullSizeMap = QString("def f(): return ") + sizeMap;
+  //         MESSAGE("SetSizeMapEntry("<<entry.toStdString()<<") = " <<fullSizeMap.toStdString());
+         h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
+       }
       }
     }
 
@@ -1876,10 +2063,10 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   }
 
   // SizeMap
-  row = 0, nbRows = mySizeMapTable->rowCount();
+  row = 0, nbRows = mySizeMapTable->topLevelItemCount();
   for ( ; row < nbRows; ++row )
   {
-      QString entry   = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
+      QString entry   = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
       if ( that->mySMPMap.contains(entry) )
         guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
   }
@@ -2064,157 +2251,441 @@ void BLSURFPluginGUI_HypothesisCreator::onDeleteOption()
 // *** BEGIN SIZE MAP ***
 // **********************
 
+void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified()
+{
+  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+  
+  if ( myGeomSelWdg2->IsObjectSelected() ){ 
+    mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
+  }
+  else if ( myGeomSelWdg1->IsObjectSelected() ){
+    mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
+  }
+  std::string entry = (string) mySMapObject->GetStudyEntry();
+  QString qEntry = QString::fromStdString(entry);
+  if (that->mySMPMap.contains(qEntry) && that->mySMPMap[qEntry] != "__TO_DELETE__" ) {  
+    addMapButton->setEnabled(false);
+    modifyMapButton->setEnabled(true);
+  }
+  else{
+    addMapButton->setEnabled(true);
+    modifyMapButton->setEnabled(false);
+  }
+      
+} 
+
+void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col)
+{ 
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked("<<col<<")")
+  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+  if (col == SMP_SIZEMAP_COLUMN){
+    QString entry   = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
+    if (!mySMPMap.contains(entry))
+      return;
+    QString sizeMap = item->data( SMP_SIZEMAP_COLUMN, Qt::EditRole ).toString();
+    CORBA::Object_var obj = entryToObject(entry); 
+    if (sizeMap.startsWith("Attractor") || sizeMap.startsWith("Constant")){  // ADVANCED MAPS
+      smpTab->setCurrentIndex(ATT_TAB);         // Change Tab
+      double phySize = that->mySMPMap[entry].toDouble();  // Retrieve values of the selected item in the current tab widgets
+      double infDist = that->myAttDistMap[entry];
+      double constDist = that->myDistMap[entry];
+      QString attEntry = that->myATTMap[entry];
+      CORBA::Object_var attObj = entryToObject(attEntry);
+      myAttSizeSpin->setValue(phySize);
+      if (sizeMap.startsWith("Attractor")){    
+       myAttDistSpin->setValue(infDist);
+        myAttractorCheck->setChecked(true);
+      }
+      else {
+       myAttractorCheck->setChecked(false);
+      }
+      if (sizeMap.startsWith("Constant") || constDist > 1e-12 ){
+       myAttDistSpin2->setValue(constDist);
+       myConstSizeCheck->setChecked(true);
+      }
+      else{
+       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
+      if (!sizeMap.startsWith("def")){
+       mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble()); 
+      }
+    }  
+  } 
+}
+
+void BLSURFPluginGUI_HypothesisCreator::onSmpTabChanged(int tab)
+{
+  myAttDistSpin->setValue(0.);           // Reinitialize widgets 
+  myAttSizeSpin->setValue(0.);
+  myAttDistSpin2->setValue(0.);
+  mySmpSizeSpin->setValue(0.); 
+  myGeomSelWdg1->deactivateSelection();
+  myGeomSelWdg2->deactivateSelection();
+  myAttSelWdg->deactivateSelection();
+  myGeomSelWdg1->SetObject(CORBA::Object::_nil());
+  myGeomSelWdg2->SetObject(CORBA::Object::_nil());
+  myAttSelWdg->SetObject(CORBA::Object::_nil());
+  myAttractorCheck->setChecked(false);
+  myConstSizeCheck->setChecked(false);
+}
+
+void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state)
+{
+  if (state == Qt::Checked){
+    myParamsGroup->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::Unchecked){   // Only attractor
+      myAttDistSpin2->setEnabled(false);
+      myAttDistLabel2->setEnabled(false);
+      myAttDistSpin2->setValue(0.);
+    }
+  }
+  if (state == Qt::Unchecked){
+    if(myConstSizeCheck->checkState() == Qt::Unchecked){  // No predefined map selected
+      myParamsGroup->setEnabled(false);
+    }
+    else{                                                 // Only constant size selected
+      myAttDistSpin->setEnabled(false);
+      myAttDistLabel->setEnabled(false);
+      myAttDistSpin->setValue(0.);
+      if (!myAttSelWdg->IsObjectSelected()){
+       myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
+      }
+    }
+  }   
+}
+
+void BLSURFPluginGUI_HypothesisCreator::onConstSizeClicked(int state)
+{
+  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()
 {
   MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveMap()");
   QList<int> selectedRows;
-  QList<QTableWidgetItem*> selected = mySizeMapTable->selectedItems();
-  QTableWidgetItem* item;
-  int row;
-  foreach( item, selected ) {
-    row = item->row();
-    if ( !selectedRows.contains( row ) )
-      selectedRows.append( row );
-  }
+  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 );
-  QListIterator<int> it( selectedRows );
+  QListIterator<QTreeWidgetItem*> it( selected );
   it.toBack();
   while ( it.hasPrevious() ) {
-      row = it.previous();
-      QString entry = mySizeMapTable->item(row,SMP_ENTRY_COLUMN)->text();
+      item = it.previous();
+      QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
       if (that->mySMPMap.contains(entry))
         that->mySMPMap[entry] = "__TO_DELETE__";
       if (that->mySMPShapeTypeMap.contains(entry))
         that->mySMPShapeTypeMap.remove(entry);
-      mySizeMapTable->removeRow(row );
+      if (that->myATTMap.contains(entry))
+        that->myATTMap.remove(entry);
+      if (that->myDistMap.contains(entry))
+        that->myDistMap.remove(entry);
+      if (that->myAttDistMap.contains(entry))
+        that->myAttDistMap.remove(entry);
+      delete item;
   }
   mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
   mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
 }
 
-void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(int row,int col)
+void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int col)
 {
-  MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< row << "," << col << ")");
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< col << ")");
+  MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
   if (col == SMP_SIZEMAP_COLUMN) {
     BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-    QString entry   = that->mySizeMapTable->item(row, SMP_ENTRY_COLUMN)->text();
-    QString sizeMap = that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->text().trimmed();
+    QString entry   = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
+    QString sizeMap = item->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
 //     MESSAGE("entry: " << entry.toStdString() << ", sizeMap: " << sizeMap.toStdString());
     if (! that->mySMPShapeTypeMap.contains(entry))
       return;
     if (that->mySMPMap.contains(entry))
-      if (that->mySMPMap[entry] == sizeMap)
+      if (that->mySMPMap[entry] == sizeMap 
+       || sizeMap.startsWith("Attractor") 
+       || sizeMap.startsWith("Constant") ){
         return;
-    QColor* bgColor = new QColor("white");
-    QColor* fgColor = new QColor("black");
+      }
+//     QColor* bgColor = new QColor("white");
+//     QColor* fgColor = new QColor("black");
+    
     if (! sizeMap.isEmpty()) {
       that->mySMPMap[entry] = sizeMap;
-      if (! sizeMapValidationFromRow(row)) {
-        bgColor->setRgb(255,0,0);
-        fgColor->setRgb(255,255,255);
-      }
+      sizeMapValidationFromEntry(entry); 
+//       if (! sizeMapValidationFromRow(row)) {
+//         bgColor->setRgb(255,0,0);
+//         fgColor->setRgb(255,255,255);
+//       }
     }
     else {
-//       MESSAGE("Size map empty: reverse to precedent value" );
-      that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setText(that->mySMPMap[entry]);
+      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));
+//     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);
   }
 }
 
-void BLSURFPluginGUI_HypothesisCreator::onAddMapOnSurface()
+void BLSURFPluginGUI_HypothesisCreator::onAddMap()
 {
- insertElementType(TopAbs_FACE);
+  if ( smpTab->currentIndex() == ATT_TAB ){    
+    if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){ 
+      mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
+      myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
+      insertAttractor(mySMapObject, myAttObject);
+    }
+  }
+  if (smpTab->currentIndex() == SMP_STD_TAB  ){
+    if ( myGeomSelWdg1->IsObjectSelected() ){
+      mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
+      insertElement(mySMapObject);  
+    }  
+  }
+  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;  
+  that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+  myAttDistSpin->setValue(0.);
+  myAttSizeSpin->setValue(0.);
+  myAttDistSpin2->setValue(0.);
+  mySmpSizeSpin->setValue(0.);
+  myGeomSelWdg1->deactivateSelection();
+  myGeomSelWdg2->deactivateSelection();
+  myAttSelWdg->deactivateSelection();
+  myGeomSelWdg1->SetObject(CORBA::Object::_nil());
+  myGeomSelWdg2->SetObject(CORBA::Object::_nil());
+  myAttSelWdg->SetObject(CORBA::Object::_nil());
+//   mySmpDistSpin->setValue(0.);
+//   mySmpSizeSpin->setValue(0.);
 }
 
-void BLSURFPluginGUI_HypothesisCreator::onAddMapOnEdge()
+void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
 {
- insertElementType(TopAbs_EDGE);
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::onModifyMap()");
+  if ( smpTab->currentIndex() == ATT_TAB ){    
+    if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){ 
+      mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
+      myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
+      insertAttractor(mySMapObject, myAttObject, /*modify = */true);
+    }
+  }
+  if (smpTab->currentIndex() == SMP_STD_TAB  ){
+    if ( myGeomSelWdg1->IsObjectSelected() ){
+      mySMapObject = myGeomSelWdg1->GetObject< GEOM::GEOM_Object >(0);
+      insertElement(mySMapObject, /*modify = */true);  
+    }  
+  }
+  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;  
+  that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+  myAttDistSpin->setValue(0.);
+  myAttSizeSpin->setValue(0.);
+  myAttDistSpin2->setValue(0.);
+  mySmpSizeSpin->setValue(0.);
+  myGeomSelWdg1->deactivateSelection();
+  myGeomSelWdg2->deactivateSelection();
+  myAttSelWdg->deactivateSelection();
+  myGeomSelWdg1->SetObject(CORBA::Object::_nil());
+  myGeomSelWdg2->SetObject(CORBA::Object::_nil());
+  myAttSelWdg->SetObject(CORBA::Object::_nil());
 }
 
-void BLSURFPluginGUI_HypothesisCreator::onAddMapOnPoint()
+void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify)
 {
- insertElementType(TopAbs_VERTEX);
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElement()");
+  BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
+    BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
+
+  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+
+  TopAbs_ShapeEnum shapeType;
+  string entry, shapeName;
+  entry = (string) anObject->GetStudyEntry();
+  MESSAGE("entry = "<<entry);
+  shapeName = anObject->GetName();
+  shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject ).ShapeType();
+  mySizeMapTable->setFocus();
+  QString shapeEntry;
+  shapeEntry = QString::fromStdString(entry);
+  double phySize = mySmpSizeSpin->value();
+  std::ostringstream oss;
+  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);
+    item = mySizeMapTable->topLevelItem( rowToChange );
+  }
+  else{
+    if (that->mySMPMap.contains(shapeEntry)) {  
+      if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
+  //             MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
+       return;
+      }
+    }
+    mySizeMapTable->addTopLevelItem(item);
+  }
+  that->mySMPMap[shapeEntry] = sizeMap;
+  that->myDistMap[shapeEntry] = 0. ;
+  that->mySMPShapeTypeMap[shapeEntry] = shapeType;
+  item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable   |Qt::ItemIsEnabled );
+  item->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(shapeEntry) );
+  item->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(shapeName)) );
+  item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(sizeMap) );
+  mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
+  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 );
+    onPhysicalMeshChanged();
+  }
 }
 
-void BLSURFPluginGUI_HypothesisCreator::insertElementType(TopAbs_ShapeEnum typeShapeAsked)
+void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify)
 {
-//   MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElementType()");
-
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
   BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
     BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
 
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-  GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
-
-  LightApp_SelectionMgr* mySel = myGeomToolSelected->selectionMgr();
 
   TopAbs_ShapeEnum shapeType;
-  string entry, shapeName;
-  SALOME_ListIO ListSelectedObjects;
-  mySel->selectedObjects(ListSelectedObjects, NULL, false );
-  if (!ListSelectedObjects.IsEmpty())
-  {
-    SALOME_ListIteratorOfListIO Object_It(ListSelectedObjects);
-    for (; Object_It.More(); Object_It.Next())
-    {
-      Handle(SALOME_InteractiveObject) anObject = Object_It.Value();
-      entry     = myGeomToolSelected->getEntryOfObject(anObject);
-      shapeName = anObject->getName();
-      shapeType         = myGeomToolSelected->entryToShapeType(entry);
-//       MESSAGE("Object Name = " << shapeName << "& Type is " << anObject->getComponentDataType() << " & ShapeType is " << shapeType);
-      if (shapeType == typeShapeAsked)
-      {
-        mySizeMapTable->setFocus();
-        QString shapeEntry;
-        shapeEntry = QString::fromStdString(entry);
-        double phySize = h->GetPhySize();
-        std::ostringstream oss;
-        oss << phySize;
-        QString sizeMap;
-        sizeMap  = QString::fromStdString(oss.str());
-        if (that->mySMPMap.contains(shapeEntry)) {
-          if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
-//             MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
-            break;
-          }
-        }
-        that->mySMPMap[shapeEntry] = sizeMap;
-        that->mySMPShapeTypeMap[shapeEntry] = typeShapeAsked;
-        int row = mySizeMapTable->rowCount() ;
-        mySizeMapTable->setRowCount( row+1 );
-        mySizeMapTable->setItem( row, SMP_ENTRY_COLUMN, new QTableWidgetItem( shapeEntry ) );
-        mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->setFlags( 0 );
-        mySizeMapTable->setItem( row, SMP_NAME_COLUMN, new QTableWidgetItem( QString::fromStdString(shapeName) ) );
-        mySizeMapTable->item( row, SMP_NAME_COLUMN )->setFlags( 0 );
-        mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( sizeMap ) );
-        mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable   |Qt::ItemIsEnabled );
-        mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
-        mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
-        mySizeMapTable->clearSelection();
-        mySizeMapTable->scrollToItem( mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN ) );
-
-        if ( myPhysicalMesh->currentIndex() != SizeMap ) {
-          myPhysicalMesh->setCurrentIndex( SizeMap );
-          onPhysicalMeshChanged();
-        }
+  string entry, attEntry, faceName, attName;
+  entry = (string) aFace->GetStudyEntry();
+  attEntry = (string) anAttractor->GetStudyEntry();
+  faceName = aFace->GetName();
+  attName = anAttractor->GetName();
+  shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aFace ).ShapeType();
+  mySizeMapTable->setFocus();
+  QString shapeEntry = QString::fromStdString(entry);
+  QString qAttEntry = QString::fromStdString(attEntry);
+  
+  double phySize = h->GetPhySize();
+  double infDist = 0. ;
+  double constDist = 0. ;
+  phySize = myAttSizeSpin->value();
+  if (myAttractorCheck->isChecked()){
+    infDist = myAttDistSpin->value();
+  }
+  if (myConstSizeCheck->isChecked()){
+    constDist = myAttDistSpin2->value();
+  } 
+  std::ostringstream oss;
+  std::ostringstream oss2;
+  std::ostringstream oss3;
+  oss << phySize;
+  oss2 << infDist;
+  oss3 << constDist;
+  QString sizeMap  = QString::fromStdString(oss.str());
+  QString infDistString = QString::fromStdString(oss2.str());
+  QString constDistString = QString::fromStdString(oss3.str());
+  
+//   int row = mySizeMapTable->topLevelItemCount();
+//   int rowToChange;
+  QTreeWidgetItem* item; 
+  QTreeWidgetItem* child; 
+  if (modify){
+    int rowToChange = findRowFromEntry(shapeEntry);
+    item = mySizeMapTable->topLevelItem( rowToChange );
+    child = item->child( 0 );
+  }
+  else{
+    if (that->mySMPMap.contains(shapeEntry)) {  
+      if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
+    //             MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
+       return;
       }
     }
+    item = new QTreeWidgetItem();
+    child = new QTreeWidgetItem();
+    mySizeMapTable->addTopLevelItem(item);
+    item->addChild(child);
+  }
+  that->mySMPMap.insert(shapeEntry,sizeMap);
+  that->myATTMap.insert(shapeEntry,qAttEntry);
+  that->myAttDistMap.insert(shapeEntry,infDist);
+  that->myDistMap.insert(shapeEntry,constDist);
+  that->mySMPShapeTypeMap.insert(shapeEntry,shapeType);
+  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){
+    item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Attractor")) );
   }
+  else if (constDist > 1e-12){
+    item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(QString::fromStdString("Constant Size")) );
+  }
+  item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable   |Qt::ItemIsEnabled );    
+  
+  child->setData(SMP_ENTRY_COLUMN, Qt::EditRole, QVariant(qAttEntry) );
+  child->setData(SMP_NAME_COLUMN, Qt::EditRole, QVariant(QString::fromStdString(attName)) );
+  child->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(sizeMap) );
+  
+  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 );
+    onPhysicalMeshChanged();
+  }
+  MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
 }
 
 bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
 {
-//   MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()");
-  int row = 0, nbRows = mySizeMapTable->rowCount();
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()");
+  int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
   for ( ; row < nbRows; ++row )
     if (! sizeMapValidationFromRow(row))
       return false;
@@ -2223,8 +2694,8 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
 
 bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError)
 {
-//   MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow()");
-  QString myEntry   = mySizeMapTable->item( myRow, SMP_ENTRY_COLUMN )->text();
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(), row = "<<myRow);
+  QString myEntry   = mySizeMapTable->topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
   bool res = sizeMapValidationFromEntry(myEntry,displayError);
   mySizeMapTable->setFocus();
   return res;
@@ -2253,7 +2724,8 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEnt
   }
   else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) {
 //     MESSAGE("Attractor" );
-    if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)\\)$")) != 1)) {
+    if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$")) != 1)) {
+
       if (displayError)
         SUIT_MessageBox::warning( dlg(),"Definition of attractor : Error" ,"An attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False[;d])" );
       return false;
@@ -2391,4 +2863,32 @@ LightApp_SelectionMgr* BLSURFPluginGUI_HypothesisCreator::selectionMgr()
     return 0;
 }
 
+CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry)
+{
+  SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
+  SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
+  CORBA::Object_var obj;
+  SALOMEDS::GenericAttribute_var anAttr;
+  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() );
+  if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
+    SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+    CORBA::String_var aVal = anIOR->Value();
+    obj = myStudy->ConvertIORToObject(aVal);
+  }
+  return obj;
+}
+
+int BLSURFPluginGUI_HypothesisCreator::findRowFromEntry(QString entry){
+  QString entryForChecking;
+  int endRow = mySizeMapTable->topLevelItemCount()-1;
+  int row = 0;
+  entryForChecking = mySizeMapTable->topLevelItem( row )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
+  while (entry != entryForChecking && row <= endRow){
+    row++;
+    entryForChecking = mySizeMapTable->topLevelItem( row )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
+  }
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
+  return row;
+}
+
 
index 84c402acf77a819d06306ea725ed2e6b8381f207..eb515a666e9efb1692710714999be0647aee29cb 100644 (file)
@@ -69,9 +69,12 @@ class QTableWidget;
 class QTreeWidget;
 class QModelIndex;
 class QSpinBox;
+class QDoubleSpinBox;
 class QMenu;
 class QAction;
 class QTreeWidgetItem;
+class QTableWidgetItem;
+class QObject;
 
 class SMESHGUI_SpinBox;
 class LightApp_SelectionMgr;
@@ -167,7 +170,11 @@ public:
 
   virtual bool        checkParams() const;
   virtual QString     helpPage() const;
-  void                insertElementType( TopAbs_ShapeEnum );
+  //void                insertElementType( TopAbs_ShapeEnum );
+  void                insertElement( GEOM::GEOM_Object_var, bool modify = false );
+  void                insertAttractor(GEOM::GEOM_Object_var, GEOM::GEOM_Object_var, bool modify = false);
+  int                 findRowFromEntry(QString entry);
+  CORBA::Object_var   entryToObject(QString entry);
   static LightApp_SelectionMgr* selectionMgr();
 
 protected:
@@ -185,12 +192,15 @@ protected slots:
   void                onAddOption();
   void                onDeleteOption();
   void                onOptionChosenInPopup( QAction* );
-//  void                onAddAttractor();
-  void                onAddMapOnSurface();
-  void                onAddMapOnEdge();
-  void                onAddMapOnPoint();
+  void                onMapGeomContentModified();
+  void                onSmpItemClicked( QTreeWidgetItem *, int );
+  void                onSmpTabChanged(int);
+  void                onAttractorClicked(int);
+  void                onConstSizeClicked(int);
+  void                onAddMap();
   void                onRemoveMap();
-  void                onSetSizeMap(int,int);
+  void                onModifyMap();
+  void                onSetSizeMap(QTreeWidgetItem *, int);
 
   void                addEnforcedVertex(std::string theFaceEntry, std::string theFaceName, double x=0, double y=0, double z=0, 
                                         std::string vertexName = "", std::string geomEntry = "", std::string groupName = "");
@@ -233,14 +243,38 @@ private:
   QSpinBox*           myVerbosity;
   QTableWidget*       myOptionTable;
 
+  // Sizemap widgets
   QWidget             *mySmpGroup;
-  QTableWidget        *mySizeMapTable;
-  QPushButton         *addAttractorButton;
-  QPushButton         *addSurfaceButton;
-  QPushButton         *addEdgeButton;
-  QPushButton         *addPointButton;
-  QPushButton         *removeButton;
-
+  QTreeWidget         *mySizeMapTable;
+  QPushButton         *addMapButton;
+  QPushButton         *removeMapButton;
+  QPushButton         *modifyMapButton;
+  QTabWidget          *smpTab; 
+  QWidget             *myAttractorGroup;
+  QWidget             *mySmpStdGroup;
+  QCheckBox           *myAttractorCheck;
+  QCheckBox           *myConstSizeCheck;
+  QGroupBox           *myDistanceGroup;
+  QGroupBox           *myParamsGroup;
+  SMESHGUI_SpinBox    *myAttSizeSpin;
+  SMESHGUI_SpinBox    *myAttDistSpin;
+  SMESHGUI_SpinBox    *myAttDistSpin2;
+  SMESHGUI_SpinBox    *mySmpSizeSpin;
+  QLabel              *myAttDistLabel;
+  QLabel              *myAttDistLabel2;
+  QLabel              *myAttSizeLabel;
+  // Selection widgets for size maps
+  StdMeshersGUI_ObjectReferenceParamWdg *myGeomSelWdg1;
+  StdMeshersGUI_ObjectReferenceParamWdg *myGeomSelWdg2;
+  StdMeshersGUI_ObjectReferenceParamWdg *myAttSelWdg;
+  StdMeshersGUI_ObjectReferenceParamWdg *myDistSelWdg;
+  GEOM::GEOM_Object_var                  mySMapObject;
+  GEOM::GEOM_Object_var                  myAttObject;
+  GEOM::GEOM_Object_var                  myDistObject;
+  
+  
+  
+  
   QWidget*            myEnfGroup;
 //    TODO FACE AND VERTEX SELECTION
   StdMeshersGUI_ObjectReferenceParamWdg *myEnfFaceWdg;
@@ -262,7 +296,10 @@ private:
   QPushButton*        removeVertexButton;
 
   // map =  entry , size map
-  QMap<QString, QString>          mySMPMap;
+  QMap<QString, QString>          mySMPMap;           // Map <face entry, size>
+  QMap<QString, QString>          myATTMap;           // Map <face entry, att. entry>
+  QMap<QString, double>           myDistMap;          // Map <entry,distance with constant size> 
+  QMap<QString, double>           myAttDistMap;       // Map <entry, influence distance> 
   QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
   GeomSelectionTools*             GeomToolSelected;
   LightApp_SelectionMgr*          aSel;
index a3e21ddb23afd71d95452bedf6177f16a39fcc8b..fecda28696b285be8ad4b8eab3509bf53df9f0e2 100644 (file)
         <source>BLSURF_SM_ATTRACTOR</source>
         <translation>Add Attractor</translation>
     </message>
+    <message>
+        <source>BLSURF_SM_STD_TAB</source>
+        <translation>Simple map</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_ATT_TAB</source>
+        <translation>Advanced</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_PARAMS</source>
+        <translation>Parameters</translation>
+    </message>
+    <message>
+        <source>BLSURF_ATTRACTOR</source>
+        <translation>Attractor</translation>
+    </message>
+    <message>
+        <source>BLSURF_CONST_SIZE</source>
+        <translation>Constant size near shape</translation>
+    </message>
+    <message>
+        <source>BLSURF_ATT_DIST</source>
+        <translation>Influence dist.</translation>
+    </message>
+    <message>
+        <source>BLSURF_ATT_RADIUS</source>
+        <translation>Constant over</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_SIZE</source>
+        <translation>Local Size</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_DIST</source>
+        <translation>Distance</translation>
+    </message>
+    <message>
+        <source>BLS_SEL_SHAPE</source>
+        <translation>Select a shape</translation>
+    </message>
+    <message>
+        <source>BLS_SEL_FACE</source>
+        <translation>Select a face</translation>
+    </message>
+    <message>
+        <source>BLS_SEL_ATTRACTOR</source>
+        <translation>Select the attractor</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_ADD</source>
+        <translation>Add</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_MODIFY</source>
+        <translation>Modify</translation>
+    </message>
     <message>
         <source>BLSURF_SM_REMOVE</source>
         <translation>Remove</translation>
index d5097362a859b6597f2dbc4d606de50a8248b18e..c7510fd99b1660599aa2c7fa1e03ad99cb59f70e 100755 (executable)
         <source>BLSURF_SM_ATTRACTOR</source>
         <translation>Ajouter un attracteur</translation>
     </message>
+    <message>
+        <source>BLSURF_SM_STD_TAB</source>
+        <translation>Simple</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_ATT_TAB</source>
+        <translation>Avancé</translation>
+    </message>
     <message>
         <source>BLSURF_SM_REMOVE</source>
         <translation>Supprimer</translation>
     </message>
+    <message>
+        <source>BLSURF_SM_ADD</source>
+        <translation>Ajouter</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_MODIFY</source>
+        <translation>Modifier</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_PARAMS</source>
+        <translation>Paramètres</translation>
+    </message>
+    <message>
+        <source>BLSURF_ATTRACTOR</source>
+        <translation>Attracteur</translation>
+    </message>
+    <message>
+        <source>BLSURF_CONST_SIZE</source>
+        <translation>Taille constante autour d'un objet</translation>
+    </message>
+    <message>
+        <source>BLSURF_ATT_DIST</source>
+        <translation>Dist. d'influence :</translation>
+    </message>
+    <message>
+        <source>BLSURF_ATT_RADIUS</source>
+        <translation>Constant sur :</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_SIZE</source>
+        <translation>Taille Locale :</translation>
+    </message>
+    <message>
+        <source>BLS_SEL_SHAPE</source>
+        <translation>Sélectionnez un objet</translation>
+    </message>
+    <message>
+        <source>BLS_SEL_FACE</source>
+        <translation>Sélectionnez une face</translation>
+    </message>
+    <message>
+        <source>BLS_SEL_ATTRACTOR</source>
+        <translation>Sélectionnez l'attracteur</translation>
+    </message>
     <message>
         <source>BLSURF_SM_SURF_VALUE</source>
         <translation>Taille sur les/la face(s)</translation>