};
enum {
-// SMP_BTNS = 0,
-// SMP_ATTRACTOR_BTN,
-// SMP_SEPARATOR1,
-// SMP_POINT_BTN,
-// SMP_EDGE_BTN,
-// SMP_SURFACE_BTN,
-// SMP_SEPARATOR2,
-// SMP_SEPARATOR,
SMP_TAB_WDG,
-// SMP_ATT_GROUP,
SMP_ADD_BTN,
-// SMP_REMOVE_BTN,
SMP_NB_LINES,
SMP_STD_TAB = 0,
ATT_TAB,
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,
mySmpGroup = new QWidget();
// mySmpGroup->setMinimumWidth(500);
- //mySmpGroup->setMinimumHeight(350);
+
//Layout
QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
+
// Table
mySizeMapTable = new QTreeWidget( mySmpGroup );
mySizeMapTable ->setMinimumWidth(250);
- // tab widget
- smpTab = new QTabWidget( mySmpGroup );
- smpTab->setTabShape( QTabWidget::Rounded );
- smpTab->setTabPosition( QTabWidget::East );
- lay->addWidget( smpTab );
-
- // Table settings
- //mySizeMapTable->setSortingEnabled(true);
QStringList sizeMapHeaders;
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->hideColumn(SMP_ENTRY_COLUMN);
- // mySizeMapTable->resizeColumnToContents(SMP_DIST_COLUMN);
mySizeMapTable->setAlternatingRowColors(true);
-// mySizeMapTable->verticalHeader()->hide();
-
-// mySizeMapTable->setShowGrid(true);
+
+ // 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;
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
+ // Geometry Selection Widgets
myGeomSelWdg1 = new StdMeshersGUI_ObjectReferenceParamWdg( myFilter1, 0, /*multiSel=*/false,/*stretch=*/false);
- myGeomSelWdg1->SetDefaultText("Select a shape", "QLineEdit { color: grey }");
+ myGeomSelWdg1->SetDefaultText(tr("BLS_SEL_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);
- modifyMapButton->setEnabled(false);
+ myGeomSelWdg2->SetDefaultText(tr("BLS_SEL_FACE"), "QLineEdit { color: grey }");// TODO ajouter aux fichiers de traduction
+
+ myGeomSelWdg1->AvoidSimultaneousSelection(myGeomSelWdg2);
- // Attractor GroupBox
- //myAttractorGroup = new QGroupBox(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup);
+ // Attractor tab
myAttractorGroup = new QWidget();
-// myAttractorGroup->setMinimumWidth(220);
-// myAttractorGroup->setCheckable(true);
-// myAttractorGroup->setChecked(false);
-// myAttractorGroup->setEnabled(false);
QGridLayout* anAttLayout = new QGridLayout(myAttractorGroup);
myAttractorCheck = new QCheckBox(tr("BLSURF_ATTRACTOR"),myAttractorGroup);
myConstSizeCheck = new QCheckBox(tr("BLSURF_CONST_SIZE"),myAttractorGroup);
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->SetDefaultText(tr("BLS_SEL_ATTRACTOR"), "QLineEdit { color: grey }"); // TODO ajouter aux fichiers de traduction
myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg1);
myAttSelWdg->AvoidSimultaneousSelection(myGeomSelWdg2);
- myGeomSelWdg1->AvoidSimultaneousSelection(myGeomSelWdg2);
-
- // 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
mySmpSizeSpin = new SMESHGUI_SpinBox(mySmpStdGroup);
mySmpSizeSpin->RangeStepAndValidator(0., COORD_MAX, 10.0, "length_precision");
QLabel* mySmpSizeLabel = new QLabel(tr("BLSURF_SM_SIZE"),mySmpStdGroup);
-
-// 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
-
-// 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);
// Init SpinBoxes
myAttDistSpin->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->setColumnStretch(0, 1);
// anSmpLayout->addWidget(line2, SMP_SEPARATOR2, 1, 2, 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->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);
-
- 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);
+ 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);
- 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);
+ // 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 );
-
-
+ smpTab->setCurrentIndex( SMP_STD_TAB );
// Enforced vertices parameters
myEnfGroup = new QWidget();
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);
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);
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
QMapIterator<QString,QString> i(that->mySMPMap);
- // QMapIterator<QString,QString> att_it(that->myATTMap);
- // QMapIterator<QString,QString> inf_dist_it(that->myAttDistMap);
- // QMapIterator<QString,QString> const_dist_it(that->myDistMap)
- // Iterate over each size map
while (i.hasNext()) {
i.next();
const QString entry = i.key();
// h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
}
else {
- // TODO coder le stockage des parametres ici dans l'idee de ce qui est fait en dessous
if (!myATTMap[entry].isEmpty()){
QString att_entry = myATTMap[entry];
double infDist = myAttDistMap[entry];
double constDist = myDistMap[entry];
double phySize = h->GetPhySize();
- //double const_dist = myDistMap[entry];
h->SetClassAttractorEntry( entry.toLatin1().constData(), att_entry.toLatin1().constData(), sizeMap.toDouble() , phySize, infDist, constDist );
}
-// else if( myAttDistMap[entry] > 1e-12) {
-// h->SetConstantSizeOnAdjacentFaces(att_entry.toLatin1().constData(), conversion en double (sizeMap), endSize = user_size, const_dist )
-// }
else {
QString fullSizeMap;
fullSizeMap = QString("");
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() );
}
}
-// 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::onSmpItemClicked(QTreeWidgetItem * item, int col)
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked("<<col<<")")
myGeomSelWdg1->SetObject(obj); // Retrieve values of the selected item in the current tab widgets
if (!sizeMap.startsWith("def")){
mySmpSizeSpin->setValue(that->mySMPMap[entry].toDouble());
-// myAttractorGroup->setChecked( false );
}
}
}
myAttDistLabel->setEnabled(true);
myAttDistSpin2->setEnabled(true);
myAttDistLabel2->setEnabled(true);
- if(myConstSizeCheck->checkState() == Qt::Unchecked){
+ 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){
+ if(myConstSizeCheck->checkState() == Qt::Unchecked){ // No predefined map selected
myParamsGroup->setEnabled(false);
}
- else{
+ else{ // Only constant size selected
myAttDistSpin->setEnabled(false);
myAttDistLabel->setEnabled(false);
myAttDistSpin->setValue(0.);
+ myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
}
}
}
myAttDistLabel->setEnabled(true);
myAttDistSpin2->setEnabled(true);
myAttDistLabel2->setEnabled(true);
- if(myAttractorCheck->checkState() == Qt::Unchecked){
+ if(myAttractorCheck->checkState() == Qt::Unchecked){ // Only constant size
myAttDistSpin->setEnabled(false);
myAttDistLabel->setEnabled(false);
myAttDistSpin->setValue(0.);
+ myAttSelWdg->SetDefaultText(tr("BLS_SEL_SHAPE"), "QLineEdit { color: grey }");
}
}
if (state == Qt::Unchecked){
- if(myAttractorCheck->checkState() == Qt::Unchecked){
+ if(myAttractorCheck->checkState() == Qt::Unchecked){ // No predefined map selected
myParamsGroup->setEnabled(false);
}
else{
- myAttDistSpin2->setEnabled(false);
+ myAttDistSpin2->setEnabled(false); // Only attractor selected
myAttDistLabel2->setEnabled(false);
myAttDistSpin2->setValue(0.);
}
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 ) );//TODO voir si l'option est utile