OPTION_NAME_COLUMN,
OPTION_VALUE_COLUMN,
NB_COLUMNS,
- SMP_ENTRY_COLUMN = 0,
- SMP_NAME_COLUMN,
+ SMP_NAME_COLUMN =0,
SMP_SIZEMAP_COLUMN,
- SMP_DIST_COLUMN,
+ SMP_ENTRY_COLUMN,
+// SMP_DIST_COLUMN,
SMP_NB_COLUMNS,
// Enforced vertices array columns
ENF_VER_NAME_COLUMN = 0,
// SMP_POINT_BTN,
// SMP_EDGE_BTN,
// SMP_SURFACE_BTN,
- SMP_GEOM_BTN,
// SMP_SEPARATOR2,
-// SMP_SEPARATOR,
+// SMP_SEPARATOR,
SMP_TAB_WDG,
// SMP_ATT_GROUP,
SMP_ADD_BTN,
// SMP_REMOVE_BTN,
SMP_NB_LINES,
SMP_STD_TAB = 0,
- ATT_TAB
-};
-
-enum {
- SMP_ATT_SHAPE,
+ 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_SPACE,
- SMP_DIST_GROUP,
-// SMP_CHECK,
SMP_SPACE2,
- SMP_DIST=0,
- SMP_DIST_SHAPE,
};
// Enforced vertices inputs
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))
{
// Size Maps parameters
mySmpGroup = new QWidget();
- mySmpGroup->setMinimumWidth(500);
+// mySmpGroup->setMinimumWidth(500);
//mySmpGroup->setMinimumHeight(350);
//Layout
QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
// Table
- mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup );
+ mySizeMapTable = new QTreeWidget( mySmpGroup );
+ mySizeMapTable ->setMinimumWidth(300);
// tab widget
smpTab = new QTabWidget( mySmpGroup );
smpTab->setTabShape( QTabWidget::Rounded );
- smpTab->setTabPosition( QTabWidget::South );
+ smpTab->setTabPosition( QTabWidget::East );
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" );
- mySizeMapTable->setHorizontalHeaderLabels(sizeMapHeaders);
- mySizeMapTable->horizontalHeader()->hideSection( SMP_ENTRY_COLUMN );
- mySizeMapTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
- mySizeMapTable->horizontalHeader()->setStretchLastSection(true);
+ sizeMapHeaders << tr( "SMP_NAME_COLUMN" )<< tr( "SMP_SIZEMAP_COLUMN" )<< tr( "SMP_ENTRY_COLUMN" );// << tr( "SMP_DIST_COLUMN" );
+ mySizeMapTable->setHeaderLabels(sizeMapHeaders);
+// mySizeMapTable->headerItem()->hideSection( SMP_ENTRY_COLUMN );
+// mySizeMapTable->headerItem()->setResizeMode(QHeaderView::Interactive);
+// mySizeMapTable->headerItem()->setStretchLastSection(true);
//mySizeMapTable->horizontalHeader()->setProperty("showSortIndicator", QVariant(true));
mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
- mySizeMapTable->resizeColumnToContents(SMP_DIST_COLUMN);
+ mySizeMapTable->hideColumn(SMP_ENTRY_COLUMN);
+ // mySizeMapTable->resizeColumnToContents(SMP_DIST_COLUMN);
mySizeMapTable->setAlternatingRowColors(true);
- mySizeMapTable->verticalHeader()->hide();
+// mySizeMapTable->verticalHeader()->hide();
- mySizeMapTable->setShowGrid(true);
+// mySizeMapTable->setShowGrid(true);
// Filters of selection
TColStd_MapOfInteger SM_ShapeTypes, 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 }");
+ myGeomSelWdg1 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter1, 0, /*multiSel=*/false,/*stretch=*/false);
+ myGeomSelWdg1->SetDefaultText("Select a shape", "QLineEdit { color: grey }");
+ myGeomSelWdg2 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter3, 0, /*multiSel=*/false,/*stretch=*/false);
+ myGeomSelWdg2->SetDefaultText("Select a face", "QLineEdit { color: grey }");
// 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);
+ modifyMapButton = new QPushButton(tr("BLSURF_SM_MODIFY"),mySmpGroup);
// Attractor GroupBox
//myAttractorGroup = new QGroupBox(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup);
// myAttractorGroup->setChecked(false);
// myAttractorGroup->setEnabled(false);
QGridLayout* anAttLayout = new QGridLayout(myAttractorGroup);
- myAttDistSpin = new QDoubleSpinBox(myAttractorGroup);
- myAttDistSpin2 = new QDoubleSpinBox(myAttractorGroup);
- myAttSizeSpin = new QDoubleSpinBox(myAttractorGroup);
- myAttDistLabel = new QLabel(tr("BLSURF_ATT_DIST"),myAttractorGroup);
- myAttDistLabel2 = new QLabel(tr("BLSURF_ATT_RADIUS"),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);
+ 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("Select the attractor", "QLineEdit { color: grey }");
+ myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg1);
+ myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg2);
// Initialization of widgets
// myAttDistSpin->hide();
QGridLayout* anSmpStdLayout = new QGridLayout(mySmpStdGroup);
// Constant Size GroupBox
- mySmpSizeSpin = new QDoubleSpinBox(mySmpStdGroup);
+ mySmpSizeSpin = new SMESHGUI_SpinBox(mySmpStdGroup);
+ mySmpSizeSpin->RangeStepAndValidator(0., COORD_MAX, 10.0, "length_precision");
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 );
- 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);
+
+// myDistanceGroup = new QGroupBox(tr("BLSURF_SM_CONST"),mySmpStdGroup);
+// myDistanceGroup->setFlat(true);
+// myDistanceGroup->setCheckable(true);
+// myDistanceGroup->setChecked(false);
+// myDistanceGroup->setEnabled(true);
+// myDistanceGroup->setVisible(false); // NOTE Désactivé pour l'instant
- // Parameters of SpinBoxes
+// QGridLayout* aDistLayout = new QGridLayout(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(myGeomSelWdg1);
+// myDistSelWdg->AvoidSimultaneousSelection(myGeomSelWdg2);
+// myDistSelWdg->AvoidSimultaneousSelection(myAttSelWdg);
- myAttDistSpin->setMaximum(1000); // TODO use preferences of SALOME
- myAttDistSpin2->setMaximum(1000);
- mySmpDistSpin->setMaximum(1000);
- myAttSizeSpin->setMaximum(1000);
- mySmpSizeSpin->setMaximum(1000);
- myAttDistSpin->setDecimals(4);
- myAttDistSpin2->setDecimals(4);
- mySmpDistSpin->setDecimals(4);
- myAttSizeSpin->setDecimals(4);
- mySmpSizeSpin->setDecimals(4);
+ // Init SpinBoxes
myAttDistSpin->setValue(0.);
myAttDistSpin2->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, 0, 0, SMP_NB_LINES, 1);
- anSmpLayout->addWidget(myGeomSelWdg, SMP_GEOM_BTN, 1, 1, 2);
+ 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, 2);
+ anSmpLayout->addWidget(smpTab, SMP_TAB_WDG, 1, 1, 3);
// 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);
+ 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);
- anAttLayout->addWidget(myAttSelWdg, SMP_ATT_SHAPE, 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->addWidget(myAttDistLabel2, SMP_ATT_RAD, 1, 1, 1);
- anAttLayout->addWidget(myAttDistSpin2, SMP_ATT_RAD, 2, 1, 1);
- anAttLayout->setRowStretch(SMP_ATT_RAD+1, 1);
+ 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);
+ 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->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" ) );
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( 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*)));
// 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 (QTableWidgetItem *)),this, SLOT( onItemClicked(QTableWidgetItem *) ) );
- connect( myGeomSelWdg, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
+ connect( mySizeMapTable, SIGNAL( itemClicked (QTreeWidgetItem *, int)),this,SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
+// connect( myGeomSelWdg2, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
connect( myAttractorGroup, SIGNAL( clicked(bool) ), this, SLOT( onAttractorGroupClicked(bool) ) );
connect( mySizeMapTable, SIGNAL( cellChanged ( int, int )), this, SLOT( onSetSizeMap(int,int ) ) );
+ connect( myAttractorCheck, SIGNAL( stateChanged ( int )), this, SLOT( onAttractorClicked( int ) ) );
+ connect( myConstSizeCheck, SIGNAL( stateChanged ( int )), this, SLOT( onConstSizeClicked( int ) ) );
// Enforced vertices
connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) );
const QString entry = i.key();
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 );
+ 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];
- MESSAGE("attEntry = "<<attEntry.toStdString())
std::string attName = myGeomToolSelected->getNameFromEntry(attEntry.toStdString());
- MESSAGE("attName = "<<attName)
+ 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){
- 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) ) );
+ 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 );
+ 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 );
+ 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
{
- 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) ) );
+ 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 );
+ Qt::ItemIsEnabled ); */
}
}
-
+ mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
}
// 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] + "); ";
}
// *** BEGIN SIZE MAP ***
// **********************
-void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified()
-{
- if ( myGeomSelWdg->IsObjectSelected() ){
- mySMapObject = myGeomSelWdg->GetObject< GEOM::GEOM_Object >(0);
- TopAbs_ShapeEnum myShapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( mySMapObject ).ShapeType();
- if ( myShapeType == TopAbs_FACE ){
- smpTab->setTabEnabled(ATT_TAB,true);
-// if (!myAttractorGroup->isChecked()){
- myDistanceGroup->setEnabled(false);
-// myDistanceGroup->setChecked(false);
-// }
- }
- else
- {
- smpTab->setTabEnabled(ATT_TAB,false);
-// myAttractorGroup->setEnabled(false);
-// myAttractorGroup->setChecked(false);
- myDistanceGroup->setEnabled(true);
- }
- }
-
-}
+// void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified()
+// {
+// if ( myGeomSelWdg2->IsObjectSelected() ){
+// mySMapObject = myGeomSelWdg2->GetObject< GEOM::GEOM_Object >(0);
+// TopAbs_ShapeEnum myShapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( mySMapObject ).ShapeType();
+// if ( myShapeType == TopAbs_FACE ){
+// smpTab->setTabEnabled(ATT_TAB,true);
+// // if (!myAttractorGroup->isChecked()){
+// myDistanceGroup->setEnabled(false);
+// // myDistanceGroup->setChecked(false);
+// // }
+// }
+// else
+// {
+// smpTab->setTabEnabled(ATT_TAB,false);
+// // myAttractorGroup->setEnabled(false);
+// // myAttractorGroup->setChecked(false);
+// myDistanceGroup->setEnabled(true);
+// }
+// }
+//
+// } NOTE inutile pour l'instant à supprimer si toujours pas utile
// void BLSURFPluginGUI_HypothesisCreator::onAttractorGroupClicked(bool checked){
// // QObjectList grpChildren = myAttractorGroup->children();
// }
// }
-void BLSURFPluginGUI_HypothesisCreator::onItemClicked(QTableWidgetItem * item)
+void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col)
{
- int row = item->row();
- int col = item->column();
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onCellClicked("<<row<<", "<<col<<")")
+
+ MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked("<<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 );
+ QString entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
+ QString sizeMap = item->data( SMP_SIZEMAP_COLUMN, Qt::EditRole ).toString();
+ CORBA::Object_var obj = entryToObject(entry);
+ myGeomSelWdg2->SetObject(obj);
+ if (sizeMap.startsWith("Attractor") || sizeMap.startsWith("Constant")){
smpTab->setCurrentIndex(ATT_TAB);
double phySize = that->mySMPMap[entry].toDouble();
double infDist = that->myAttDistMap[entry];
double constDist = that->myDistMap[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);
- myAttDistSpin2->setValue(constDist);
- }
- 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);
+ if (sizeMap.startsWith("Attractor")){
+ myAttDistSpin->setValue(infDist);
+ myAttractorCheck->setChecked(true);
+ }
+ if (sizeMap.startsWith("Constant") || constDist > 1e-12 ){
+ myAttDistSpin2->setValue(constDist);
+ myConstSizeCheck->setChecked(true);
+ }
}
else {
- smpTab->setCurrentIndex(SMP_STD_TAB);
- CORBA::Object_var obj = entryToObject(entry);
- myGeomSelWdg->SetObject(obj);
+ smpTab->setCurrentIndex(SMP_STD_TAB);
if (!sizeMap.startsWith("def")){
mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble());
// myAttractorGroup->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(myConstSizeCheck->checkState() == Qt::Unchecked){
+ myAttDistSpin2->setEnabled(false);
+ myAttDistLabel2->setEnabled(false);
+ myAttDistSpin2->setValue(0.);
+ }
+ }
+ if (state == Qt::Unchecked){
+ if(myConstSizeCheck->checkState() == Qt::Unchecked){
+ myParamsGroup->setEnabled(false);
+ }
+ else{
+ myAttDistSpin->setEnabled(false);
+ myAttDistLabel->setEnabled(false);
+ myAttDistSpin->setValue(0.);
+ }
+ }
+}
+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){
+ myAttDistSpin->setEnabled(false);
+ myAttDistLabel->setEnabled(false);
+ myAttDistSpin->setValue(0.);
+ }
+ }
+ if (state == Qt::Unchecked){
+ if(myAttractorCheck->checkState() == Qt::Unchecked){
+ myParamsGroup->setEnabled(false);
+ }
+ else{
+ myAttDistSpin2->setEnabled(false);
+ 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->myDistMap.remove(entry);
if (that->myAttDistMap.contains(entry))
that->myAttDistMap.remove(entry);
- mySizeMapTable->removeRow(row );
+ 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 (! sizeMap.isEmpty()) {
that->mySMPMap[entry] = sizeMap;
- sizeMapValidationFromRow(row);
+ // sizeMapValidationFromRow(row); // TODO utiliser sizempavalidationfromitem
// if (! sizeMapValidationFromRow(row)) {
// bgColor->setRgb(255,0,0);
// fgColor->setRgb(255,255,255);
MESSAGE("Size map empty: reverse to precedent value" );
}
if (sizeMap.isEmpty()) {
- that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->setText(that->mySMPMap[entry]);
+ 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));
void BLSURFPluginGUI_HypothesisCreator::onAddMap()
{
- if ( myGeomSelWdg->IsObjectSelected() ){
- mySMapObject = myGeomSelWdg->GetObject< GEOM::GEOM_Object >(0);
-// if ( myAttractorGroup->isChecked() ){
- if ( smpTab->currentIndex() == ATT_TAB ){
- if ( myAttSelWdg->IsObjectSelected() ){
- myAttObject = myAttSelWdg->GetObject< GEOM::GEOM_Object >(0);
- insertAttractor(mySMapObject, myAttObject);
- }
+ 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 ( 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);
- }
+ }
+ 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.);
+ myGeomSelWdg1->deactivateSelection();
+ myGeomSelWdg2->deactivateSelection();
+ myAttSelWdg->deactivateSelection();
+// mySmpDistSpin->setValue(0.);
+// mySmpSizeSpin->setValue(0.);
+}
+
+void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
+{
+ 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);
}
- BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
- that->getGeomSelectionTool()->selectionMgr()->clearFilters();
- myAttDistSpin->setValue(0.);
- myAttSizeSpin->setValue(0.);
- myAttDistSpin2->setValue(0.);
- mySmpDistSpin->setValue(0.);
- mySmpSizeSpin->setValue(0.);
- myGeomSelWdg->deactivateSelection();
- myDistSelWdg->deactivateSelection();
}
+ 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.);
+ myGeomSelWdg1->deactivateSelection();
+ myGeomSelWdg2->deactivateSelection();
+ myAttSelWdg->deactivateSelection();
}
-void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject)
+void BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify)
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElement()");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
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;
-// }
-// }
+ // int row = mySizeMapTable->rowCount();
+ // mySizeMapTable->setRowCount( row + 1 );
+ QTreeWidgetItem* item = new QTreeWidgetItem();
+ if (modify){
+ int rowToChange = findRowFromEntry(shapeEntry);
+ item = mySizeMapTable->takeTopLevelItem( 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;
- 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->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( ) );
- mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
- mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
+ 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->addTopLevelItem(item);
+
mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
- mySizeMapTable->resizeColumnToContents( SMP_DIST_COLUMN );
mySizeMapTable->clearSelection();
- mySizeMapTable->scrollToItem( mySizeMapTable->item( row , SMP_SIZEMAP_COLUMN ) );
+// mySizeMapTable->scrollToItem( mySizeMapTable->item( row , SMP_SIZEMAP_COLUMN ) ); //TODO voir si cette option est utile
if ( myPhysicalMesh->currentIndex() != SizeMap ) {
myPhysicalMesh->setCurrentIndex( SizeMap );
}
}
-void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool influence)
+void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify)
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
double phySize = h->GetPhySize();
double infDist = 0. ;
double constDist = 0. ;
- if (smpTab->currentIndex()==ATT_TAB){ // ATTRACTOR
+ phySize = myAttSizeSpin->value();
+ if (myAttractorCheck->isChecked()){
infDist = myAttDistSpin->value();
- phySize = myAttSizeSpin->value();
- constDist = myAttDistSpin2->value();
- }
- else{ // SIZE MAP WITH CONSTANT SIZE AROUND
- phySize = mySmpSizeSpin->value();
- if (myDistanceGroup->isChecked()){
- constDist = mySmpDistSpin->value();
- }
}
- myGeomSelWdg->SetObject(CORBA::Object::_nil());
+ if (myConstSizeCheck->isChecked()){
+ constDist = myAttDistSpin2->value();
+ }
std::ostringstream oss;
std::ostringstream oss2;
std::ostringstream oss3;
QString infDistString = QString::fromStdString(oss2.str());
QString constDistString = QString::fromStdString(oss3.str());
- int row = mySizeMapTable->rowCount();
- int rowToChange;
- 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 );
- mySizeMapTable->setItem( row, SMP_NAME_COLUMN, new QTableWidgetItem( ) );
- mySizeMapTable->item( row, SMP_NAME_COLUMN )->setFlags( 0 );
- 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::ItemIsEnabled);
- rowToChange = row;
- }
- // if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
-// // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
-// return;
-// }
- else {
- rowToChange = findRowFromEntry(shapeEntry);
- MESSAGE("rowToChange = "<<rowToChange)
+// 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);
- if (smpTab->currentIndex()==ATT_TAB){
- 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);
+ 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 {
- 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( rowToChange, SMP_DIST_COLUMN )->setText(constDistString);
+ 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->resizeColumnToContents( SMP_DIST_COLUMN );
- mySizeMapTable->clearSelection();
- mySizeMapTable->scrollToItem( mySizeMapTable->item( row , SMP_SIZEMAP_COLUMN ) );
+// mySizeMapTable->resizeColumnToContents( SMP_DIST_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 );
bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()");
- int row = 0, nbRows = mySizeMapTable->rowCount();
+ int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
for ( ; row < nbRows; ++row )
if (! sizeMapValidationFromRow(row))
return false;
bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError)
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(), row = "<<myRow);
- QString myEntry = mySizeMapTable->item( myRow, SMP_ENTRY_COLUMN )->text();
+ QString myEntry = mySizeMapTable->topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
bool res = sizeMapValidationFromEntry(myEntry,displayError);
mySizeMapTable->setFocus();
return res;
int BLSURFPluginGUI_HypothesisCreator::findRowFromEntry(QString entry){
QString entryForChecking;
- int endRow = mySizeMapTable->rowCount()-1;
+ int endRow = mySizeMapTable->topLevelItemCount()-1;
int row = 0;
- entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
+ entryForChecking = mySizeMapTable->topLevelItem( row )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
while (entry != entryForChecking && row <= endRow){
row++;
- entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
+ entryForChecking = mySizeMapTable->topLevelItem( row )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
}
MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
return row;