From: Jérôme Date: Mon, 5 Oct 2020 17:00:45 +0000 (+0200) Subject: Solve issues X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=87caa15165a4f9f7faf74cf980d2c48e588cfc79;p=modules%2Fshaper.git Solve issues --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp index e52156a8c..79292632e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp @@ -72,7 +72,6 @@ void FeaturesPlugin_Fillet::initAttributes() data()->addAttribute(VALUES_ID(), ModelAPI_AttributeTables::typeId()); data()->addAttribute(VALUES_CURV_ID(), ModelAPI_AttributeTables::typeId()); data()->addAttribute(EDGE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(EDGEFACE_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(ARRAY_POINT_RADIUS_BY_POINTS(), ModelAPI_AttributeSelectionList::typeId()); @@ -103,16 +102,8 @@ void FeaturesPlugin_Fillet::attributeChanged(const std::string& theID) AttributeSelectionPtr anEdges = std::dynamic_pointer_cast(attribute(EDGE_SELECTED_ID())); AttributeSelectionListPtr array = selectionList(OBJECT_LIST_ID()); - array->append(anEdges->namingName() ); - - selection( EDGEFACE_SELECTED_ID())->setValue( anEdges->context(), anEdges->value()); - } - else if (theID == EDGEFACE_SELECTED_ID() - && string(CREATION_METHOD())->value() == CREATION_METHOD_MULTIPLES_RADIUSES()) { - - AttributeSelectionPtr anEdges = - std::dynamic_pointer_cast(attribute(EDGEFACE_SELECTED_ID())); - AttributeSelectionListPtr array = selectionList(OBJECT_LIST_ID()); + if(array->isInitialized()) + array->clear(); array->append(anEdges->namingName() ); } } @@ -138,6 +129,7 @@ GeomMakeShapePtr FeaturesPlugin_Fillet::performOperation(const GeomShapePtr& the ListOfShape aFilletEdges = extractEdges(theEdges); + std::cout << "coucou aCreationMethod->value() = " << aCreationMethod->value()<< std::endl; if ( aCreationMethod->value() == CREATION_METHOD_MULTIPLES_RADIUSES() ) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h index f06195b02..ff7f2774d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h @@ -106,13 +106,6 @@ public: return MY_EDGE_SELECTED_ID; } - /// Attribute name of edge selected. - inline static const std::string& EDGEFACE_SELECTED_ID() - { - static const std::string MY_EDGEFACE_SELECTED_ID("edgeface_selected"); - return MY_EDGEFACE_SELECTED_ID; - } - /// attribute name of list of tables that contain deafult values (row 0) and the custom values inline static const std::string& VALUES_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.cpp b/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.cpp index 5d4b30b37..377873745 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.cpp @@ -124,13 +124,14 @@ ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), { QVBoxLayout* aMainLayout = new QVBoxLayout(this); - aMainLayout->addWidget(new QLabel("Raduises", this)); + aMainLayout->addWidget(new QLabel("Radii", this)); // Radiuses controls QFrame* aRadiusesFrame = new QFrame(this); + aRadiusesFrame->setFrameShape( QFrame::HLine ); aRadiusesFrame->setFrameShape(QFrame::Box); aRadiusesFrame->setFrameStyle(QFrame::StyledPanel); - QVBoxLayout* aRadiusesLayout = new QVBoxLayout(aRadiusesFrame); - aMainLayout->addWidget(aRadiusesFrame); + QVBoxLayout* aRadiusesLayout = new QVBoxLayout(); + myDataTbl = new QTableWidget(2, 3, aRadiusesFrame); @@ -166,7 +167,7 @@ ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), QStringList aHeaders; aHeaders << "Point"; - aHeaders << "Curvilinear /n Abscissa"; + aHeaders << "Curvilinear Abscissa"; aHeaders << "Radius"; @@ -211,9 +212,12 @@ ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0), font.setPointSize(12); myRemoveBtn->setFont(font); aBtnLayout->addWidget(myRemoveBtn); + + aRadiusesFrame->setLayout(aRadiusesLayout ) ; + aMainLayout->addWidget(aRadiusesFrame); - connect(aAddBtn, SIGNAL(clicked(bool)), SLOT(onAddStep())); - connect(myRemoveBtn, SIGNAL(clicked(bool)), SLOT(onRemoveStep())); + connect(aAddBtn, SIGNAL(clicked(bool)), SLOT(onAdd())); + connect(myRemoveBtn, SIGNAL(clicked(bool)), SLOT(onRemove())); connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), SLOT(onFocusChanged(QWidget*, QWidget*))); } @@ -365,8 +369,7 @@ bool FeaturesPlugin_WidgetFilletMultiRadiuses::restoreValueCustom() AttributeSelectionPtr anEdges = std::dynamic_pointer_cast(aData->attribute(FeaturesPlugin_Fillet::EDGE_SELECTED_ID())); - if( !anEdges->isInitialized() ) - return; + std::map> aValuesSort; @@ -375,6 +378,9 @@ bool FeaturesPlugin_WidgetFilletMultiRadiuses::restoreValueCustom() std::map>::iterator itValuesSort; if(myTypeMethodeBypoint) { + if( !anEdges->isInitialized() ) + return; + GeomEdgePtr anEdge = GeomEdgePtr(new GeomAPI_Edge( anEdges->value())); GeomPointPtr first = anEdge->firstPoint(); GeomPointPtr last = anEdge->lastPoint(); @@ -424,12 +430,12 @@ bool FeaturesPlugin_WidgetFilletMultiRadiuses::restoreValueCustom() }else{ ModelAPI_AttributeTables::Value aVal; - if (aTablesAttr->isInitialized()){ + if (aTablesAttr->isInitialized()){ for (int anIndex = 0; anIndex < aTablesAttr->rows(); ++anIndex) { aVal = aTablesAttr->value(anIndex,0); double curv = getValueText(aVal).toDouble(); - if ( aValuesSort.find( curv ) == aValuesSort.end() ) + if ( aValuesSort.find( curv ) == aValuesSort.end() ) aValuesSort[ curv ] = std::make_pair(getValueText(aVal), findRadius(getValueText(aVal))); } aRows = aTablesAttr->rows(); @@ -474,7 +480,7 @@ bool FeaturesPlugin_WidgetFilletMultiRadiuses::restoreValueCustom() aItem = new QTableWidgetItem(aCurv); myDataTbl->setItem(k, 1, aItem); } - aItem = myDataTbl->item(k, 2); + aItem = myDataTbl->item(k, 2); if (aItem) { aItem->setText( elem.second); } else { @@ -493,7 +499,7 @@ bool FeaturesPlugin_WidgetFilletMultiRadiuses::restoreValueCustom() //********************************************************************************** -void FeaturesPlugin_WidgetFilletMultiRadiuses::onAddStep() +void FeaturesPlugin_WidgetFilletMultiRadiuses::onAdd() { QModelIndex index = myDataTbl->currentIndex(); @@ -510,7 +516,10 @@ void FeaturesPlugin_WidgetFilletMultiRadiuses::onAddStep() i = myDataTbl->rowCount() - 2; if ( i == 0) - i =1; + i = 1; + else + i= i+1; + myDataTbl->model()->insertRow(i); QTableWidgetItem* aItem =0; @@ -526,14 +535,14 @@ void FeaturesPlugin_WidgetFilletMultiRadiuses::onAddStep() myDataTbl->setItem(i, 2, aItem); aItem = new QTableWidgetItem(myLastRowValue[2]); myDataTbl->setItem(i, 2, aItem); - myDataTbl->blockSignals(false); - + emit valuesChanged(); + myDataTbl->setCurrentCell( i, 0); } //********************************************************************************** -void FeaturesPlugin_WidgetFilletMultiRadiuses::onRemoveStep() +void FeaturesPlugin_WidgetFilletMultiRadiuses::onRemove() { QModelIndex index = myDataTbl->currentIndex(); @@ -643,7 +652,7 @@ bool FeaturesPlugin_WidgetFilletMultiRadiuses:: aShape = aValue->shape(); if ( (aResult.get() || aShape.get() ) && !aSelList->isInList(aResult, aShape)) { aSelList->append(aResult, aShape); - onRemoveStep(); + onRemove(); }else{ mySetSelection = false; return false; diff --git a/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.h b/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.h index b29b1e23d..10eb4ad5f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.h +++ b/src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.h @@ -114,11 +114,11 @@ protected: private slots: - /// Slot called on add a step - void onAddStep(); + /// Slot called on add a row + void onAdd(); - /// Slot called on remove a step - void onRemoveStep(); + /// Slot called on remove a row + void onRemove(); /// Retunrs a list of possible shape types /// \return a list of shapes diff --git a/src/FeaturesPlugin/fillet_widget.xml b/src/FeaturesPlugin/fillet_widget.xml index 4601b0388..1ba6e708f 100644 --- a/src/FeaturesPlugin/fillet_widget.xml +++ b/src/FeaturesPlugin/fillet_widget.xml @@ -64,8 +64,11 @@ icon="icons/Features/edge.png" label="Start" tooltip="Select edge" - shape_types="edge"> + shape_types="edge" + use_choice="false" + concealment="true"> + @@ -76,13 +79,16 @@ title="By curvilinear abscissa" tooltip="Fillet with multiple radiuses by curvilinear abscissa" icon="icons/Features/fillet_multiradius_by_curv.png"> - - - + + + +