From 45b46f7833b028ffc398aa324e8e606409d3eb5b Mon Sep 17 00:00:00 2001 From: gdd Date: Wed, 30 Mar 2011 14:11:15 +0000 Subject: [PATCH] rnc: - French translations - Small improvements of GUI - Small bug fixes --- src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx | 4 +- src/BLSURFPlugin/BLSURFPlugin_Attractor.hxx | 11 +- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 49 ++--- src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 204 +++++------------- src/GUI/BLSURFPluginGUI_HypothesisCreator.h | 10 +- src/GUI/BLSURFPlugin_msg_en.ts | 20 +- src/GUI/BLSURFPlugin_msg_fr.ts | 52 +++++ 7 files changed, 146 insertions(+), 204 deletions(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx b/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx index 8c26eb1..ad23179 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx @@ -116,13 +116,12 @@ bool BLSURFPlugin_Attractor::init(){ ShapeConstruct_ProjectCurveOnSurface curveProjector; curveProjector.Init(aSurf, Precision::Confusion()); curveProjector.PerformAdvanced (aCurve3d, first, last, aCurve2d); - //Handle(Geom2d_Curve) Curve2d = BRep_Tool::CurveOnSurface(TopoDS::Edge(_attractorShape), _face, first, last); int N = 20 * (last - first) / _step; // If the edge is a circle : 4>Pi so the number of points on the edge should be good -> 5 for ellipses for (i=0; i<=N; i++){ P2 = aCurve2d->Value(first + i * (last-first) / N); i0 = floor( (P2.X() - _u1) * _gridU / (_u2 - _u1) + 0.5 ); j0 = floor( (P2.Y() - _v1) * _gridV / (_v2 - _v1) + 0.5 ); - MESSAGE("i0 = "< GetParameters() const + double GetSize (double u, double v); + TopoDS_Face GetFace() const { return _face; } + TopoDS_Shape GetAttractorShape() const { return _attractorShape; } + std::string GetAttractorEntry() const { return _attEntry; } + double GetStep() const { return _step; } + std::vector GetParameters() const { double tab_params[] = {_startSize, _endSize, _actionRadius, _constantRadius}; std::vector params (tab_params, tab_params + sizeof(tab_params) / sizeof(double) ); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index 4c2ff2e..4e51e65 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -955,22 +955,16 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) { test << " " << "__NEW_ATTRACTORS_BEGIN__"; for (; it_At != _classAttractors.end(); ++it_At) { std::vector attParams; - attParams = it_At->second->GetParameters(); + attParams = it_At->second->GetParameters(); + double step = it_At->second->GetStep(); save << " " << it_At->first; -// save << " " << "__BEGIN_AT_SHAPE__"; save << " " << it_At->second->GetAttractorEntry(); -// save << " " << "__END_AT_SHAPE__"; -// save << " " << "__BEGIN_AT_PARAMS__"; - save << " " << attParams[0] << " " << attParams[1] << " " << attParams[2] << " " << attParams[3]; -// save << " " << "__END_AT_PARAMS__"<< "%#"; // "%#" is a mark of value end - //test + save << " " << attParams[0] << " " << attParams[1] << " " << attParams[2] << " " << attParams[3]; + save << " " << step; test << " " << it_At->first; -// test << " " << "__BEGIN_AT_SHAPE__"; test << " " << it_At->second->GetAttractorEntry(); -// test << " " << "__END_AT_SHAPE__"; -// test << " " << "__BEGIN_AT_PARAMS__"; - test << " " << attParams[0] << " " << attParams[1] << " " << attParams[2] << " " << attParams[3]; -// test << " " << "__END_AT_PARAMS__"<< "%#"; // "%#" is a mark of value end + test << " " << attParams[0] << " " << attParams[1] << " " << attParams[2] << " " << attParams[3]; + test << " " << step; } save << " " << "__NEW_ATTRACTORS_END__"; test << " " << "__NEW_ATTRACTORS_END__"; @@ -1248,7 +1242,8 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { std::string newAtFaceEntry, atTestString; std::string newAtShapeEntry; - double AttParams[4]; + double attParams[4]; + double step; while (isOK && hasNewAttractor) { std::cout<<"Load new attractor"<> newAtFaceEntry); @@ -1258,30 +1253,16 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { isOK = (load >> newAtShapeEntry); if (!isOK) break; - isOK = (load >> AttParams[0]>>AttParams[1]>>AttParams[2]>>AttParams[3]); + isOK = (load >> attParams[0]>>attParams[1]>>attParams[2]>>attParams[3]>>step); } if (isOK) { MESSAGE(" LOADING ATTRACTOR HYPOTHESIS ") - const TopoDS_Shape AttractorShape = BLSURFPlugin_Hypothesis::entryToShape(newAtShapeEntry); - const TopoDS_Face FaceShape = TopoDS::Face(BLSURFPlugin_Hypothesis::entryToShape(newAtFaceEntry)); - BLSURFPlugin_Attractor* Attractor = new BLSURFPlugin_Attractor(FaceShape, AttractorShape, newAtShapeEntry); - Attractor->SetParameters(AttParams[0], AttParams[1], AttParams[2], AttParams[3]); - _classAttractors[newAtFaceEntry]=Attractor; -// load >> atTestString; -// std::string & value4 = atTestString; -// int len4 = value4.size(); -// // continue reading until "%#" encountered -// while (value4[len4 - 1] != '#' || value4[len4 - 2] != '%') { -// isOK = (load >> atTestString); -// if (isOK) { -// value4 += " "; -// value4 += atTestString; -// len4 = value4.size(); -// } else { -// break; -// } -// } -// value4[len4 - 2] = '\0'; //cut off "%#" + const TopoDS_Shape attractorShape = BLSURFPlugin_Hypothesis::entryToShape(newAtShapeEntry); + const TopoDS_Face faceShape = TopoDS::Face(BLSURFPlugin_Hypothesis::entryToShape(newAtFaceEntry)); + BLSURFPlugin_Attractor* attractor = new BLSURFPlugin_Attractor(faceShape, attractorShape, newAtShapeEntry, step); + attractor->SetParameters(attParams[0], attParams[1], attParams[2], attParams[3]); + attractor->BuildMap(); + _classAttractors[newAtFaceEntry]=attractor; } } diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 1e40b89..3b748cd 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -125,18 +125,8 @@ enum { }; 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, @@ -165,6 +155,7 @@ enum { ENF_VER_Y_COORD, ENF_VER_Z_COORD, ENF_VER_GROUP, + ENF_VER_SPACE, ENF_VER_VERTEX_BTN, ENF_VER_REMOVE_BTN, // ENF_VER_SEPARATOR, @@ -796,35 +787,32 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() 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; @@ -840,26 +828,16 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() 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); @@ -876,42 +854,17 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() 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.); @@ -920,42 +873,39 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() 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(); @@ -996,11 +946,11 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() shapeTypes2.Add( TopAbs_COMPOUND ); SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1); - myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true); + myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true, /*stretch=*/false); myEnfFaceWdg->SetDefaultText("Select Faces", "QLineEdit { color: grey }"); SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2); - myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true); + myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false); myEnfVertexWdg->SetDefaultText("Select Vertices", "QLineEdit { color: grey }"); myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg); @@ -1048,6 +998,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1); anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1); anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1); + anEnfLayout2->setRowStretch( ENF_VER_SPACE, 1); anEnfLayout2->addWidget(addVertexButton, ENF_VER_VERTEX_BTN, 0, 1, 2); anEnfLayout2->addWidget(removeVertexButton, ENF_VER_REMOVE_BTN, 0, 1, 2); // anEnfLayout->addWidget(line, ENF_VER_SEPARATOR, 0, 1, 2); @@ -1894,10 +1845,6 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; QMapIterator i(that->mySMPMap); - // QMapIterator att_it(that->myATTMap); - // QMapIterator inf_dist_it(that->myAttDistMap); - // QMapIterator const_dist_it(that->myDistMap) - // Iterate over each size map while (i.hasNext()) { i.next(); const QString entry = i.key(); @@ -1916,18 +1863,13 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi // 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(""); @@ -1937,7 +1879,6 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi fullSizeMap = QString("def f(t): return ") + sizeMap; else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX) fullSizeMap = QString("def f(): return ") + sizeMap; - // MESSAGE("SetSizeMapEntry("<SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() ); } @@ -2332,38 +2273,6 @@ void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified() } -// 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("<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 ); } } } @@ -2434,20 +2342,22 @@ void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state) 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 }"); } } } @@ -2460,18 +2370,19 @@ void BLSURFPluginGUI_HypothesisCreator::onConstSizeClicked(int state) 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.); } @@ -2754,7 +2665,6 @@ void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF 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 diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h index 454a41b..eb515a6 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h @@ -192,10 +192,7 @@ protected slots: void onAddOption(); void onDeleteOption(); void onOptionChosenInPopup( QAction* ); -// void onAddAttractor(); -// void onMapSelectionActivated(); void onMapGeomContentModified(); -// void onAttractorGroupClicked(bool); void onSmpItemClicked( QTreeWidgetItem *, int ); void onSmpTabChanged(int); void onAttractorClicked(int); @@ -246,12 +243,9 @@ private: QSpinBox* myVerbosity; QTableWidget* myOptionTable; + // Sizemap widgets QWidget *mySmpGroup; QTreeWidget *mySizeMapTable; - QPushButton *addAttractorButton; - QPushButton *addSurfaceButton; - QPushButton *addEdgeButton; - QPushButton *addPointButton; QPushButton *addMapButton; QPushButton *removeMapButton; QPushButton *modifyMapButton; @@ -269,7 +263,7 @@ private: QLabel *myAttDistLabel; QLabel *myAttDistLabel2; QLabel *myAttSizeLabel; - // Sizemap widgets + // Selection widgets for size maps StdMeshersGUI_ObjectReferenceParamWdg *myGeomSelWdg1; StdMeshersGUI_ObjectReferenceParamWdg *myGeomSelWdg2; StdMeshersGUI_ObjectReferenceParamWdg *myAttSelWdg; diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index 9737ce8..fecda28 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -135,10 +135,6 @@ SMP_SIZEMAP_COLUMN Local size - - SMP_DIST_COLUMN - Constant size dist. - BLSURF_SM_SURFACE On face (or group) @@ -183,10 +179,6 @@ BLSURF_ATT_RADIUS Constant over - - BLSURF_SM_CONST - Keep constant size near shape - BLSURF_SM_SIZE Local Size @@ -195,6 +187,18 @@ BLSURF_SM_DIST Distance + + BLS_SEL_SHAPE + Select a shape + + + BLS_SEL_FACE + Select a face + + + BLS_SEL_ATTRACTOR + Select the attractor + BLSURF_SM_ADD Add diff --git a/src/GUI/BLSURFPlugin_msg_fr.ts b/src/GUI/BLSURFPlugin_msg_fr.ts index d509736..c7510fd 100755 --- a/src/GUI/BLSURFPlugin_msg_fr.ts +++ b/src/GUI/BLSURFPlugin_msg_fr.ts @@ -151,10 +151,62 @@ BLSURF_SM_ATTRACTOR Ajouter un attracteur + + BLSURF_SM_STD_TAB + Simple + + + BLSURF_SM_ATT_TAB + Avancé + BLSURF_SM_REMOVE Supprimer + + BLSURF_SM_ADD + Ajouter + + + BLSURF_SM_MODIFY + Modifier + + + BLSURF_SM_PARAMS + Paramètres + + + BLSURF_ATTRACTOR + Attracteur + + + BLSURF_CONST_SIZE + Taille constante autour d'un objet + + + BLSURF_ATT_DIST + Dist. d'influence : + + + BLSURF_ATT_RADIUS + Constant sur : + + + BLSURF_SM_SIZE + Taille Locale : + + + BLS_SEL_SHAPE + Sélectionnez un objet + + + BLS_SEL_FACE + Sélectionnez une face + + + BLS_SEL_ATTRACTOR + Sélectionnez l'attracteur + BLSURF_SM_SURF_VALUE Taille sur les/la face(s) -- 2.39.2