]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
rnc: Modified and improved IHM Geodesic_Attractor_20110316
authorgdd <gdd>
Wed, 16 Mar 2011 09:00:22 +0000 (09:00 +0000)
committergdd <gdd>
Wed, 16 Mar 2011 09:00:22 +0000 (09:00 +0000)
src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.h
src/GUI/BLSURFPlugin_msg_en.ts

index 891108cd3d6250048f7dd487adf4709525bb0bba..7edd1ec42768d2e01965a5928346a1171174c756 100644 (file)
@@ -207,12 +207,17 @@ double BLSURFPlugin_Attractor::GetSize(double u, double v){
   switch(_type)
   {
     case TYPE_EXP:
-//       if (fabs(_actionRadius) < eps){ // TODO definir eps et decommenter
-//     return _endSize;
-//       }
-//       else{
-      return _endSize - (_endSize - _startSize) * exp(- myDist * myDist / (_actionRadius * _actionRadius) );
-//       }
+      if (fabs(_actionRadius) < 1e-12){ // TODO definir eps et decommenter
+       if (myDist < 1e-12){
+         return _startSize;
+       }
+       else {
+         return _endSize;
+       }
+      }
+      else{
+       return _endSize - (_endSize - _startSize) * exp(- myDist * myDist / (_actionRadius * _actionRadius) );
+      }
       break;
     case TYPE_LIN:
       return _startSize + ( 0.5 * (_distance(u,v) - _constantRadius + abs(_distance(u,v) - _constantRadius)) ) ;
index db43e8534383a1cd5015dacf65942dc72565ad84..4fdfd3180bd8a6bbac77952a72762afc472e7834 100644 (file)
@@ -479,7 +479,7 @@ void BLSURFPlugin_Hypothesis::SetClassAttractorEntry(const std::string& entry, c
   if ( !attExists || (attExists && _classAttractors[entry]->GetAttractorEntry().compare(attEntry) != 0)){ 
     ShapeAnalysis::GetFaceUVBounds(FaceShape,u1,u2,v1,v2);
     diag = sqrt((u2 - u1) * (u2 - u1) + (v2 - v1) * (v2 - v1));  
-    BLSURFPlugin_Attractor* myAttractor = new BLSURFPlugin_Attractor(FaceShape, AttractorShape, attEntry, 0.003 * diag); 
+    BLSURFPlugin_Attractor* myAttractor = new BLSURFPlugin_Attractor(FaceShape, AttractorShape, attEntry, 0.002 * diag); 
     myAttractor->BuildMap();
     myAttractor->SetParameters(StartSize, EndSize, ActionRadius, ConstantRadius);
     _classAttractors[entry] = myAttractor;
index 1c20f6aa9af7d806254526bc991278813b16789c..f045ca64755d2cfe2bcc0fed4a5d3a3542871751 100644 (file)
@@ -40,6 +40,7 @@
 #include <SUIT_ResourceMgr.h>
 #include <SalomeApp_Tools.h>
 
+#include <QObject>
 #include <QComboBox>
 #include <QLabel>
 #include <QGroupBox>
@@ -124,31 +125,38 @@ enum {
 };
 
 enum {
-  SMP_BTNS = 0,
+//  SMP_BTNS = 0,
 //   SMP_ATTRACTOR_BTN,
 //   SMP_SEPARATOR1,
 //  SMP_POINT_BTN,
 //  SMP_EDGE_BTN,
 //  SMP_SURFACE_BTN,
   SMP_GEOM_BTN,
-  SMP_SEPARATOR2,
-  SMP_ATT_GROUP,
-  SMP_DIST_GROUP,
+//   SMP_SEPARATOR2,
+//   SMP_SEPARATOR,
+  SMP_TAB_WDG,
+//  SMP_ATT_GROUP, 
   SMP_ADD_BTN,
-  SMP_REMOVE_BTN,
-  SMP_NB_LINES
+//  SMP_REMOVE_BTN,
+  SMP_NB_LINES,
+  SMP_STD_TAB = 0,
+  ATT_TAB
 };
   
 enum {
-  SMP_ATT_BTNS = 0,
   SMP_ATT_SHAPE,
   SMP_ATT_SIZE,
   SMP_ATT_DIST
 };
 
 enum {
-  SMP_DIST_BTNS = 0,
-  SMP_DIST
+  SMP_SIZE,
+  SMP_SPACE,
+  SMP_DIST_GROUP,
+//  SMP_CHECK,
+  SMP_SPACE2,
+  SMP_DIST=0,
+  SMP_DIST_SHAPE,
 };
 
 // Enforced vertices inputs
@@ -754,11 +762,19 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   // Size Maps parameters
 
   mySmpGroup = new QWidget();
-  mySmpGroup->setMinimumWidth(450);
-//   mySmpGroup->setMinimumHeight(300);
+  mySmpGroup->setMinimumWidth(500);
+  //mySmpGroup->setMinimumHeight(350);
+  //Layout
   QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
-  //anSmpLayout->setColumnStretch(0,1);
+  // Table
   mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup );
+  // tab widget
+  smpTab = new QTabWidget( mySmpGroup );
+  smpTab->setTabShape( QTabWidget::Rounded );
+  smpTab->setTabPosition( QTabWidget::South );
+  lay->addWidget( smpTab );
+  
+  // Table settings
   //mySizeMapTable->setSortingEnabled(true);
   QStringList sizeMapHeaders;
   sizeMapHeaders << tr( "SMP_ENTRY_COLUMN" )<< tr( "SMP_NAME_COLUMN" ) << tr( "SMP_SIZEMAP_COLUMN" ) << tr( "SMP_DIST_COLUMN" );
@@ -786,64 +802,114 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   
   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);
   
   // Size Map GroupBox
   myGeomSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter1, 0, /*multiSel=*/false,/*stretch=*/false);
   myGeomSelWdg->SetDefaultText("Select a Shape", "QLineEdit { color: grey }");
-  QFrame *line2 = new QFrame(mySmpGroup);
-  line2->setFrameShape(QFrame::HLine);
-  line2->setFrameShadow(QFrame::Sunken);
+//   QFrame *line2 = new QFrame(mySmpGroup);
+//   line2->setFrameShape(QFrame::HLine);
+//   line2->setFrameShadow(QFrame::Sunken);
   removeMapButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup);
   addMapButton = new QPushButton(tr("BLSURF_SM_ADD"),mySmpGroup);
   
   // Attractor GroupBox
-  myAttractorGroup = new QGroupBox(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup);
-  myAttractorGroup->setCheckable(true);
-  myAttractorGroup->setChecked(false);
-  myAttractorGroup->setEnabled(false);
+  //myAttractorGroup = new QGroupBox(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup);
+  myAttractorGroup = new QWidget();
+//   myAttractorGroup->setMinimumWidth(220);
+//   myAttractorGroup->setCheckable(true);
+//   myAttractorGroup->setChecked(false);
+//   myAttractorGroup->setEnabled(false);
   QGridLayout* anAttLayout = new QGridLayout(myAttractorGroup);
   myAttDistSpin = new QDoubleSpinBox(myAttractorGroup);
   myAttSizeSpin = new QDoubleSpinBox(myAttractorGroup);
-  QLabel* myAttDistLabel = new QLabel(tr("BLSURF_ATT_DIST"),myAttractorGroup);
-  QLabel* myAttSizeLabel = new QLabel(tr("BLSURF_ATT_SIZE"),myAttractorGroup);
+  myAttDistLabel = new QLabel(tr("BLSURF_ATT_DIST"),myAttractorGroup);
+  myAttSizeLabel = new QLabel(tr("BLSURF_ATT_SIZE"),myAttractorGroup);
   myAttSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter2, myAttractorGroup, /*multiSel=*/false,/*stretch=*/false);
   myAttSelWdg->SetDefaultText("Select a Shape", "QLineEdit { color: grey }");
   myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg);
   
-  myAttDistSpin->setValue(0.);
-  myAttSizeSpin->setValue(0.);
+  // Initialization of widgets
+//   myAttDistSpin->hide();
+//   myAttSizeSpin->hide();
+//   myAttDistLabel->hide();
+//   myAttSizeLabel->hide();
+//   myAttSelWdg->hide();
+  
+  // Standard size map tab
+  mySmpStdGroup = new QWidget();
+  QGridLayout* anSmpStdLayout = new QGridLayout(mySmpStdGroup);
+  
   // Constant Size GroupBox
-  myDistanceGroup = new QGroupBox(tr("BLSURF_SM_CONST"),mySmpGroup);
+  mySmpSizeSpin = new QDoubleSpinBox(mySmpStdGroup);
+  QLabel* mySmpSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),mySmpStdGroup);
+//   myConstSizeCheck = new QCheckBox(tr("BLSURF_SM_CONST"),mySmpStdGroup);
+  myDistanceGroup = new QGroupBox(tr("BLSURF_SM_CONST"),mySmpStdGroup);
+  myDistanceGroup->setFlat(true);
   myDistanceGroup->setCheckable(true);
   myDistanceGroup->setChecked(false);
   myDistanceGroup->setEnabled(false);
-  QGridLayout* aDistLayout = new QGridLayout(myDistanceGroup);
+  
+  QGridLayout* aDistLayout = new QGridLayout(myDistanceGroup );
   mySmpDistSpin = new QDoubleSpinBox(myDistanceGroup);
   QLabel* mySmpDistLabel = new QLabel(tr("BLSURF_SM_DIST"),myDistanceGroup);
+  myDistSelWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter3, myDistanceGroup, /*multiSel=*/true,/*stretch=*/false);
+  myDistSelWdg->SetDefaultText("On Face(s)", "QLineEdit { color: grey }");
+  myDistSelWdg->AvoidSimultaneousSelection(myGeomSelWdg);
+  myDistSelWdg->AvoidSimultaneousSelection(myAttSelWdg);
+  
+  // Parameters of SpinBoxes
   
+  myAttDistSpin->setMaximum(1000); // TODO use preferences of SALOME
+  mySmpDistSpin->setMaximum(1000);
+  myAttSizeSpin->setMaximum(1000);
+  mySmpSizeSpin->setMaximum(1000);
+  myAttDistSpin->setDecimals(4);
+  mySmpDistSpin->setDecimals(4);
+  myAttSizeSpin->setDecimals(4);
+  mySmpSizeSpin->setDecimals(4);
+  myAttDistSpin->setValue(0.);
+  myAttSizeSpin->setValue(0.);
+  mySmpDistSpin->setValue(0.);
+  mySmpSizeSpin->setValue(0.);
   
   // ADD WIDGETS (SIZEMAP TAB)
 //  anSmpLayout->addWidget(mySizeMapTable,     SMP_POINT_BTN, 0, SMP_NB_LINES+1, 1);
-  anSmpLayout->addWidget(mySizeMapTable,      1, 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(mySizeMapTable,      0, 0, SMP_NB_LINES, 1);
   anSmpLayout->addWidget(myGeomSelWdg,       SMP_GEOM_BTN, 1, 1, 2);
-  anSmpLayout->addWidget(line2,              SMP_SEPARATOR2, 1, 1, 2);
-  anSmpLayout->addWidget(myAttractorGroup,   SMP_ATT_GROUP, 1, 1, 2);
-  anAttLayout->addWidget(myAttDistLabel,     SMP_ATT_DIST, 1, 1, 1);
-  anAttLayout->addWidget(myAttDistSpin,      SMP_ATT_DIST, 2, 1, 1);
-  anAttLayout->addWidget(myAttSizeLabel,     SMP_ATT_SIZE, 1, 1, 1);
-  anAttLayout->addWidget(myAttSizeSpin,      SMP_ATT_SIZE, 2, 1, 1);
+//  anSmpLayout->addWidget(line2,              SMP_SEPARATOR2, 1, 2, 2);
+  anSmpLayout->addWidget(smpTab,             SMP_TAB_WDG, 1, 1, 2);
+//   anSmpLayout->addWidget(myAttractorGroup,   SMP_ATT_GROUP, 1, 1, 2);
+//   anSmpLayout->addWidget(myDistanceGroup,    SMP_DIST_GROUP, 1, 1, 2);
+  anSmpLayout->setRowStretch(SMP_TAB_WDG, 1);
+  anSmpLayout->addWidget(addMapButton,       SMP_ADD_BTN, 1, 1, 1);
+  anSmpLayout->addWidget(removeMapButton,    SMP_ADD_BTN, 2, 1, 1);
+  
   anAttLayout->addWidget(myAttSelWdg,        SMP_ATT_SHAPE, 1, 1, 2);
-  anSmpLayout->addWidget(myDistanceGroup,    SMP_DIST_GROUP, 1, 1, 2);
-  aDistLayout->addWidget(mySmpDistLabel,     SMP_DIST, 1, 1, 1);
-  aDistLayout->addWidget(mySmpDistSpin,      SMP_DIST, 2, 1, 1);
-  anSmpLayout->addWidget(addMapButton,          SMP_ADD_BTN, 1, 1, 2);
-  anSmpLayout->addWidget(removeMapButton,       SMP_REMOVE_BTN, 1, 1, 2);
+  anAttLayout->addWidget(myAttSizeLabel,     SMP_ATT_SIZE,  1, 1, 1);
+  anAttLayout->addWidget(myAttSizeSpin,      SMP_ATT_SIZE,  2, 1, 1);
+  anAttLayout->addWidget(myAttDistLabel,     SMP_ATT_DIST,  1, 1, 1);
+  anAttLayout->addWidget(myAttDistSpin,      SMP_ATT_DIST,  2, 1, 1);
+  anAttLayout->setRowStretch(SMP_ATT_DIST+1, 1);
+  
+  anSmpStdLayout->addWidget(mySmpSizeLabel,  SMP_SIZE,      1, 1, 1);
+  anSmpStdLayout->addWidget(mySmpSizeSpin,   SMP_SIZE,      2, 1, 1);
+//   anSmpStdLayout->addWidget(myDistanceGroup, SMP_DIST_GROUP, 1, 1, 2);
+//   anSmpStdLayout->setRowStretch(SMP_DIST_GROUP+1, 1);
+//  
+//  anSmpStdLayout->addWidget(myConstSizeCheck,SMP_CHECK, 1, 1, 2);
+  anSmpStdLayout->addWidget(myDistanceGroup, SMP_DIST_GROUP, 1, 1, 2);
+  aDistLayout->addWidget(mySmpDistLabel,     SMP_DIST,       1, 1, 1);
+  aDistLayout->addWidget(mySmpDistSpin,      SMP_DIST,       2, 1, 1);
+  aDistLayout->addWidget(myDistSelWdg,       SMP_DIST_SHAPE, 1, 1, 2);
+//   aDistLayout->setRowMinimumHeight(SMP_CHECK, 15);
+  anSmpStdLayout->setRowMinimumHeight(SMP_SPACE, 12);
+  anSmpStdLayout->setRowStretch(SMP_SPACE2, 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 );
   
 
 
@@ -1416,9 +1482,23 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
       MESSAGE("attEntry = "<<attEntry.toStdString())
       std::string attName = myGeomToolSelected->getNameFromEntry(attEntry.toStdString());
       MESSAGE("attName = "<<attName)
-      mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( QString::fromStdString("Attractor :" + attName)  ) );
-      mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |
+      if (that->myAttDistMap[entry] > 1e-12){
+       mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( QString::fromStdString("Attractor :" + attName)  ) );
+       mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |
+                                                               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 );                                                           
+      }
+      else{
+       mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( QString::fromStdString("Const. size from : " + attName + " (size = ") + sizeMap + QString::fromStdString(" )") ) );
+       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
     {
@@ -1426,10 +1506,11 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
       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->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_NAME_COLUMN );
@@ -2220,31 +2301,54 @@ void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified()
     mySMapObject = myGeomSelWdg->GetObject< GEOM::GEOM_Object >(0);
     TopAbs_ShapeEnum myShapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( mySMapObject ).ShapeType();
     if ( myShapeType == TopAbs_FACE ){
-      myAttractorGroup->setEnabled(true);
-      if (!myAttractorGroup->isChecked()){
-       myDistanceGroup->setEnabled(false);
-       myDistanceGroup->setChecked(false);
-      }
+      smpTab->setTabEnabled(ATT_TAB,true);
+//       if (!myAttractorGroup->isChecked()){
+      myDistanceGroup->setEnabled(false);
+//     myDistanceGroup->setChecked(false);
+//       }
     }
     else
     {
-      myAttractorGroup->setEnabled(false);
-      myAttractorGroup->setChecked(false);
+      smpTab->setTabEnabled(ATT_TAB,false);
+//       myAttractorGroup->setEnabled(false);
+//       myAttractorGroup->setChecked(false);
       myDistanceGroup->setEnabled(true);
     }
   }
     
 }
 
-void BLSURFPluginGUI_HypothesisCreator::onAttractorGroupClicked(bool checked){
-  if (checked){
-    myDistanceGroup->setEnabled(true);
-  }
-  else{
-    myDistanceGroup->setEnabled(false);
-    myDistanceGroup->setChecked(false);
-  } 
-}
+// void BLSURFPluginGUI_HypothesisCreator::onAttractorGroupClicked(bool checked){
+// //   QObjectList grpChildren = myAttractorGroup->children();
+// //   QObjectList::iterator it;
+// //   QObject* myChild;
+//   if (checked){
+//     myDistanceGroup->setEnabled(true);
+//     myAttDistSpin->show();    // TODO voir si on garde ça
+//     myAttSizeSpin->show();
+//     myAttDistLabel->show();
+//     myAttSizeLabel->show();
+//     myAttSelWdg->show();
+// //     for(it = grpChildren.begin(); it != grpChildren.end(); it++){
+// //       myChild=*it;
+// //       myChild->hide();
+// //     }
+//   }
+//   else{
+//     myDistanceGroup->setEnabled(false);
+//     myDistanceGroup->setChecked(false);
+//     myAttDistSpin->hide();
+//     myAttSizeSpin->hide();
+//     myAttDistLabel->hide();
+//     myAttSizeLabel->hide();
+//     myAttSelWdg->hide();
+//   
+// //     for(it = grpChildren.begin(); it != grpChildren.end(); it++){
+// //       myChild=*it;
+// //       myChild->show();
+// //     }
+//   } 
+// }
 
 void BLSURFPluginGUI_HypothesisCreator::onItemClicked(QTableWidgetItem * item)
 { 
@@ -2257,26 +2361,43 @@ void BLSURFPluginGUI_HypothesisCreator::onItemClicked(QTableWidgetItem * item)
     QString sizeMap = that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->text().trimmed();
     
     if (sizeMap.startsWith("Attractor :")){
-      myAttractorGroup->setChecked( true );
-      myDistanceGroup->setChecked( true );
-      myDistanceGroup->setEnabled( true );
+//       myAttractorGroup->setChecked( true );
+//       myDistanceGroup->setChecked( true );
+//       myDistanceGroup->setEnabled( true );
+      smpTab->setCurrentIndex(ATT_TAB);
       double phySize = that->mySMPMap[entry].toDouble();
       double infDist = that->myAttDistMap[entry];
       QString attEntry = that->myATTMap[entry];
       CORBA::Object_var attObj = entryToObject(attEntry);
+      CORBA::Object_var obj = entryToObject(entry); 
       
+      myGeomSelWdg->SetObject(obj); 
       myAttSelWdg->SetObject(attObj);
       myAttSizeSpin->setValue(phySize);
       myAttDistSpin->setValue(infDist);
     }
-    else {
-      myAttractorGroup->setChecked( false );
+    else if (sizeMap.startsWith("Const.")){
+      smpTab->setCurrentIndex(SMP_STD_TAB);
+      myDistanceGroup->setChecked( true );
+      myDistanceGroup->setEnabled( true );
+      double constDist = that->myDistMap[entry];
+      QString attEntry = that->myATTMap[entry];
+      mySmpDistSpin->setValue(constDist); 
+      mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble());
+      CORBA::Object_var attObj = entryToObject(attEntry);
+      CORBA::Object_var obj = entryToObject(entry);  
+      myGeomSelWdg->SetObject(attObj);
+      myDistSelWdg->SetObject(obj);
     }
-    CORBA::Object_var obj = entryToObject(entry);
-    double constDist = that->myDistMap[entry];
-    
-    myGeomSelWdg->SetObject(obj);
-    mySmpDistSpin->setValue(constDist);     
+    else {
+      smpTab->setCurrentIndex(SMP_STD_TAB);
+      CORBA::Object_var obj = entryToObject(entry); 
+      myGeomSelWdg->SetObject(obj); 
+      if (!sizeMap.startsWith("def")){
+       mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble()); 
+//       myAttractorGroup->setChecked( false );
+      }
+    }  
   }
 }
 
@@ -2331,7 +2452,9 @@ void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(int row,int col)
     if (! that->mySMPShapeTypeMap.contains(entry))
       return;
     if (that->mySMPMap.contains(entry))
-      if (that->mySMPMap[entry] == sizeMap || sizeMap.startsWith("Attractor :")){
+      if (that->mySMPMap[entry] == sizeMap 
+       || sizeMap.startsWith("Attractor :") 
+       || sizeMap.startsWith("Const.") ){
         return;
       }
 //     QColor* bgColor = new QColor("white");
@@ -2363,14 +2486,26 @@ void BLSURFPluginGUI_HypothesisCreator::onAddMap()
 {
   if ( myGeomSelWdg->IsObjectSelected() ){ 
     mySMapObject = myGeomSelWdg->GetObject< GEOM::GEOM_Object >(0);
-    if ( myAttractorGroup->isChecked() ){
+//     if ( myAttractorGroup->isChecked() ){
+    if ( smpTab->currentIndex() == ATT_TAB ){
       if ( myAttSelWdg->IsObjectSelected() ){ 
        myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
        insertAttractor(mySMapObject, myAttObject);
       }
     }
-    else {
-      insertElement(mySMapObject);  
+//     if ( myDistanceGroup->isChecked() && !myAttractorGroup->isChecked())
+    if (smpTab->currentIndex() == SMP_STD_TAB  ){
+      if ( myDistSelWdg->IsObjectSelected() ){
+       int Nb_obj = myDistSelWdg->NbObjects();
+       int i = 0;
+       for (; i!=Nb_obj; i++){
+         myDistObject = myDistSelWdg->GetObject< GEOM::GEOM_Object >(i);
+         insertAttractor(myDistObject, mySMapObject, false);
+       }
+      }
+      else {
+       insertElement(mySMapObject);  
+      }  
     }
     BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;  
     that->getGeomSelectionTool()->selectionMgr()->clearFilters();
@@ -2397,17 +2532,17 @@ void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb
   mySizeMapTable->setFocus();
   QString shapeEntry;
   shapeEntry = QString::fromStdString(entry);
-  double phySize = h->GetPhySize();
+  double phySize = mySmpSizeSpin->value();
   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 << ")");
-      return;
-    }
-  }
+//   if (that->mySMPMap.contains(shapeEntry)) {  
+//     if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
+// //             MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
+//       return;
+//     }
+//   }
   that->mySMPMap[shapeEntry] = sizeMap;
   that->myDistMap[shapeEntry] = 0. ;
   that->mySMPShapeTypeMap[shapeEntry] = shapeType;
@@ -2433,7 +2568,7 @@ void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb
   }
 }
 
-void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor)
+void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool influence)
 {
   MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
   BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
@@ -2452,9 +2587,15 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
   QString shapeEntry = QString::fromStdString(entry);
   QString qAttEntry = QString::fromStdString(attEntry);
   
-  //double phySize = h->GetPhySize();
-  double phySize = myAttSizeSpin->value();
-  double infDist = myAttDistSpin->value();
+  double phySize = h->GetPhySize();
+  double infDist = 0. ;
+  if (influence){
+    infDist = myAttDistSpin->value();
+    phySize = myAttSizeSpin->value();
+  }
+  else{
+    phySize = mySmpSizeSpin->value();
+  }
   double constDist = 0. ;
   if (myDistanceGroup->isChecked()){
     constDist = mySmpDistSpin->value();
@@ -2494,13 +2635,20 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
   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);
-  mySizeMapTable->item( rowToChange, SMP_ENTRY_COLUMN )->setText(shapeEntry);
-  mySizeMapTable->item( rowToChange, SMP_NAME_COLUMN )->setText( QString::fromStdString(faceName));
-  mySizeMapTable->item( rowToChange, SMP_SIZEMAP_COLUMN )->setText(QString::fromStdString("Attractor : "+attName));
-  mySizeMapTable->item( rowToChange, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
-  mySizeMapTable->item( rowToChange, SMP_DIST_COLUMN )->setText(constDistString );
+  if (influence){
+    mySizeMapTable->item( rowToChange, SMP_ENTRY_COLUMN )->setText(shapeEntry);
+    mySizeMapTable->item( rowToChange, SMP_NAME_COLUMN )->setText( QString::fromStdString(faceName));
+    mySizeMapTable->item( rowToChange, SMP_SIZEMAP_COLUMN )->setText(QString::fromStdString("Attractor : "+attName));
+  }
+  else {
+    that->myDistMap.insert(shapeEntry,constDist);
+    mySizeMapTable->item( rowToChange, SMP_ENTRY_COLUMN )->setText(shapeEntry);
+    mySizeMapTable->item( rowToChange, SMP_NAME_COLUMN )->setText( QString::fromStdString(faceName));
+    mySizeMapTable->item( rowToChange, SMP_SIZEMAP_COLUMN )->setText(QString::fromStdString("Const. size from : " + attName + " (size = ") + sizeMap + QString::fromStdString(" )"));
+    mySizeMapTable->item( rowToChange, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
+    mySizeMapTable->item( row, SMP_DIST_COLUMN )->setText(constDistString);
+  }
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_DIST_COLUMN );
index a412e706d8033e0104fd15c84ee08500c93f619f..971cd59232096a8ae3f56b54147ac2b4f808ae04 100644 (file)
@@ -74,6 +74,7 @@ class QMenu;
 class QAction;
 class QTreeWidgetItem;
 class QTableWidgetItem;
+class QObject;
 
 class SMESHGUI_SpinBox;
 class LightApp_SelectionMgr;
@@ -141,7 +142,7 @@ public:
   virtual QString     helpPage() const;
   //void                insertElementType( TopAbs_ShapeEnum );
   void                insertElement( GEOM::GEOM_Object_var );
-  void                insertAttractor(GEOM::GEOM_Object_var, GEOM::GEOM_Object_var);
+  void                insertAttractor(GEOM::GEOM_Object_var, GEOM::GEOM_Object_var, bool influence = true);
   int                 findRowFromEntry(QString entry);
   CORBA::Object_var   entryToObject(QString entry);
   static LightApp_SelectionMgr* selectionMgr();
@@ -164,7 +165,7 @@ protected slots:
 //  void                onAddAttractor();
 //  void                onMapSelectionActivated();
   void                onMapGeomContentModified();
-  void                onAttractorGroupClicked(bool);
+//   void                onAttractorGroupClicked(bool);
   void                onItemClicked( QTableWidgetItem * );
   void                onAddMap();
   void                onRemoveMap();
@@ -219,16 +220,27 @@ private:
   QPushButton         *addPointButton;
   QPushButton         *addMapButton;
   QPushButton         *removeMapButton;
-  QGroupBox           *myAttractorGroup;
+  QTabWidget          *smpTab; 
+  QWidget             *myAttractorGroup;
+  QWidget             *mySmpStdGroup;
+  QCheckBox           *myConstSizeCheck;
   QGroupBox           *myDistanceGroup;
   QDoubleSpinBox      *myAttSizeSpin;
   QDoubleSpinBox      *myAttDistSpin;
-  QDoubleSpinBox      *mySmpDistSpin; 
+  QDoubleSpinBox      *mySmpDistSpin;
+  QDoubleSpinBox      *mySmpSizeSpin;
+  QLabel              *myAttDistLabel;
+  QLabel              *myAttSizeLabel;
   // Sizemap widgets
   StdMeshersGUI_ObjectReferenceParamWdg *myGeomSelWdg;
   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
index 4c9360daa5b86e0e5f20ed1a273142792815b3a6..92000e9fb5f3af7d08f962e18ca8871c3cb20768 100644 (file)
         <source>BLSURF_SM_ATTRACTOR</source>
         <translation>Add Attractor</translation>
     </message>
+    <message>
+        <source>BLSURF_SM_STD_TAB</source>
+        <translation>Classic map</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_ATT_TAB</source>
+        <translation>Attractor</translation>
+    </message>
     <message>
         <source>BLSURF_ATT_DIST</source>
         <translation>Influence dist.</translation>
     </message>
     <message>
         <source>BLSURF_SM_CONST</source>
-        <translation>Keep size constant</translation>
+        <translation>Keep constant size near shape</translation>
+    </message>
+    <message>
+        <source>BLSURF_SM_SIZE</source>
+        <translation>Local Size</translation>
     </message>
     <message>
         <source>BLSURF_SM_DIST</source>