]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
rnc : some slight ameliorations (all parameters are retrieved in spinboxes and lineed...
authorgdd <gdd>
Thu, 10 Mar 2011 16:50:53 +0000 (16:50 +0000)
committergdd <gdd>
Thu, 10 Mar 2011 16:50:53 +0000 (16:50 +0000)
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPlugin_msg_en.ts

index e895b6ef99cafac93d0679e07784446810a8acc2..1c20f6aa9af7d806254526bc991278813b16789c 100644 (file)
@@ -611,7 +611,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 );
 
@@ -752,8 +754,10 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   // Size Maps parameters
 
   mySmpGroup = new QWidget();
+  mySmpGroup->setMinimumWidth(450);
+//   mySmpGroup->setMinimumHeight(300);
   QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
-
+  //anSmpLayout->setColumnStretch(0,1);
   mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup );
   //mySizeMapTable->setSortingEnabled(true);
   QStringList sizeMapHeaders;
@@ -770,16 +774,6 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   mySizeMapTable->verticalHeader()->hide();
   mySizeMapTable->setShowGrid(true);
   
-/*
-  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);
-  
   // Filters of selection
   TColStd_MapOfInteger SM_ShapeTypes, ATT_ShapeTypes;
   
@@ -1434,7 +1428,8 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
                                                                Qt::ItemIsEnabled );
     }
     mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( QString::number( that->myDistMap[entry], 'g',  6) ) );
-    mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( 0 );
+    mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |
+                                                               Qt::ItemIsEnabled );
   }
 
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
@@ -2228,6 +2223,7 @@ void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified()
       myAttractorGroup->setEnabled(true);
       if (!myAttractorGroup->isChecked()){
        myDistanceGroup->setEnabled(false);
+       myDistanceGroup->setChecked(false);
       }
     }
     else
@@ -2246,9 +2242,45 @@ void BLSURFPluginGUI_HypothesisCreator::onAttractorGroupClicked(bool checked){
   }
   else{
     myDistanceGroup->setEnabled(false);
+    myDistanceGroup->setChecked(false);
   } 
 }
 
+void BLSURFPluginGUI_HypothesisCreator::onItemClicked(QTableWidgetItem * item)
+{ 
+  int row = item->row();
+  int col = item->column();
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::onCellClicked("<<row<<", "<<col<<")")
+  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+  if (col == SMP_SIZEMAP_COLUMN){
+    QString entry   = that->mySizeMapTable->item(row, SMP_ENTRY_COLUMN)->text();
+    QString sizeMap = that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->text().trimmed();
+    
+    if (sizeMap.startsWith("Attractor :")){
+      myAttractorGroup->setChecked( true );
+      myDistanceGroup->setChecked( true );
+      myDistanceGroup->setEnabled( true );
+      double phySize = that->mySMPMap[entry].toDouble();
+      double infDist = that->myAttDistMap[entry];
+      QString attEntry = that->myATTMap[entry];
+      CORBA::Object_var attObj = entryToObject(attEntry);
+      
+      myAttSelWdg->SetObject(attObj);
+      myAttSizeSpin->setValue(phySize);
+      myAttDistSpin->setValue(infDist);
+    }
+    else {
+      myAttractorGroup->setChecked( false );
+    }
+    CORBA::Object_var obj = entryToObject(entry);
+    double constDist = that->myDistMap[entry];
+    
+    myGeomSelWdg->SetObject(obj);
+    mySmpDistSpin->setValue(constDist);     
+  }
+}
+
+
 
 void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
 {
@@ -2287,54 +2319,6 @@ void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
   mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
 }
 
-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;
-}
-
-void BLSURFPluginGUI_HypothesisCreator::onItemClicked(QTableWidgetItem * item)
-{ 
-  int row = item->row();
-  int col = item->column();
-  MESSAGE("BLSURFPluginGUI_HypothesisCreator::onCellClicked("<<row<<", "<<col<<")")
-  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-  if (col == SMP_SIZEMAP_COLUMN){
-    QString entry   = that->mySizeMapTable->item(row, SMP_ENTRY_COLUMN)->text();
-    QString sizeMap = that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->text().trimmed();
-    
-    if (sizeMap.startsWith("Attractor :")){
-      myAttractorGroup->setChecked( true );
-      myDistanceGroup->setChecked( true );
-      double phySize = that->mySMPMap[entry].toDouble();
-      double infDist = that->myAttDistMap[entry];
-      QString attEntry = that->myATTMap[entry];
-      CORBA::Object_var attObj = entryToObject(attEntry);
-      
-      myAttSelWdg->SetObject(attObj);
-      myAttSizeSpin->setValue(phySize);
-      myAttDistSpin->setValue(infDist);
-    }
-    else {
-      myAttractorGroup->setChecked( false );
-    }
-    CORBA::Object_var obj = entryToObject(entry);
-    double constDist = that->myDistMap[entry];
-    
-    myGeomSelWdg->SetObject(obj);
-    mySmpDistSpin->setValue(constDist);     
-  }
-}
-
 void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(int row,int col)
 {
   MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< row << "," << col << ")");
@@ -2436,7 +2420,7 @@ void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb
   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( ) );
-  mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( 0 );
+  mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_DIST_COLUMN );
@@ -2449,19 +2433,6 @@ void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb
   }
 }
 
-int BLSURFPluginGUI_HypothesisCreator::findRowFromEntry(QString entry){
-  QString entryForChecking;
-  int endRow = mySizeMapTable->rowCount()-1;
-  int row = 0;
-  entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
-  while (entry != entryForChecking && row <= endRow){
-    row++;
-    entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
-  }
-  MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
-  return row;
-}
-
 void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor)
 {
   MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
@@ -2500,7 +2471,7 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
   
   int row = mySizeMapTable->rowCount();
   int rowToChange;
-  if (!that->mySMPMap.contains(shapeEntry)) { 
+  if (!that->mySMPMap.contains(shapeEntry) || that->mySMPMap[shapeEntry] == "__TO_DELETE__") { 
     mySizeMapTable->setRowCount( row + 1 );
     mySizeMapTable->setItem( row, SMP_ENTRY_COLUMN, new QTableWidgetItem( ) );
     mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->setFlags( 0 );
@@ -2509,7 +2480,7 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
     mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( ) );
     mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
     mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( ) );
-    mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled);
+    mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled);
     rowToChange = row;
   }
   //     if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
@@ -2528,6 +2499,7 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF
   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 );
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
@@ -2723,4 +2695,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->rowCount()-1;
+  int row = 0;
+  entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
+  while (entry != entryForChecking && row <= endRow){
+    row++;
+    entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
+  }
+  MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
+  return row;
+}
+
 
index 7c2433c2505e93c6e07da6e08e0afbb8b81719b8..4c9360daa5b86e0e5f20ed1a273142792815b3a6 100644 (file)
         <source>BLSURF_ATT_DIST</source>
         <translation>Influence dist.</translation>
     </message>
+    <message>
+        <source>BLSURF_ATT_SIZE</source>
+        <translation>Start size</translation>
+    </message>
     <message>
         <source>BLSURF_SM_CONST</source>
         <translation>Keep size constant</translation>
     </message>
     <message>
         <source>BLSURF_SM_ADD</source>
-        <translation>Add</translation>
+        <translation>Add / Modify</translation>
     </message>
     <message>
         <source>BLSURF_SM_REMOVE</source>