]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Solve issues
authorJérôme <jerome.lucas@cesgenslab.fr>
Mon, 5 Oct 2020 17:00:45 +0000 (19:00 +0200)
committerJérôme <jerome.lucas@cesgenslab.fr>
Mon, 5 Oct 2020 17:00:45 +0000 (19:00 +0200)
src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp
src/FeaturesPlugin/FeaturesPlugin_Fillet.h
src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.cpp
src/FeaturesPlugin/FeaturesPlugin_WidgetFilletMultiRadiuses.h
src/FeaturesPlugin/fillet_widget.xml

index e52156a8c9d6390d57ecc378a11e69d014b00ce9..79292632e7660350e1ffffa1089f8669e465e7c2 100644 (file)
@@ -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<ModelAPI_AttributeSelection>(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<ModelAPI_AttributeSelection>(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() )
   {
 
index f06195b02d817ab639e8e199ae901d541dc31e50..ff7f2774d459b7a300072451692bc106e87520d1 100644 (file)
@@ -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()
   {
index 5d4b30b3750f788027ec559fb2a7c33699d54ef7..377873745d103202efc9b31f8e35faaf59a415ac 100644 (file)
@@ -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<ModelAPI_AttributeSelection>(aData->attribute(FeaturesPlugin_Fillet::EDGE_SELECTED_ID()));
 
-  if( !anEdges->isInitialized() )
-      return;
+  
   
   std::map<double,std::pair<QString,QString>> aValuesSort; 
 
@@ -375,6 +378,9 @@ bool FeaturesPlugin_WidgetFilletMultiRadiuses::restoreValueCustom()
   std::map<double,std::pair<QString,QString>>::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; 
index b29b1e23d73a70492573dbfe1d4558d25c4f7efb..10eb4ad5f074c999e2d652d213fc878a9bab5dfb 100644 (file)
@@ -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
index 4601b038831a495fb487b732ba194b622b10e7f5..1ba6e708f072d0838d936b29881baf04799e949a 100644 (file)
                         icon="icons/Features/edge.png"
                         label="Start"
                         tooltip="Select edge"
-                        shape_types="edge">
+                        shape_types="edge"
+                        use_choice="false"
+                        concealment="true">
            <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
+           <!--validator id="FeaturesPlugin_ValidatorFilletSelection"/-->
           </shape_selector>
           <multiradius-panel id="array_point_radius_by_point"
             filter_points="false">
          title="By curvilinear abscissa"
          tooltip="Fillet with multiple radiuses by curvilinear abscissa"
          icon="icons/Features/fillet_multiradius_by_curv.png">
-          <shape_selector id="edgeface_selected"
-                        icon="icons/Features/edge.png"
-                        label="Start"
-                        tooltip="Select edge"
-                        shape_types="edge face">
-           <validator id="GeomValidators_ShapeType" parameters="empty,line,face"/>
-          </shape_selector>
+          <multi_selector id="main_objects"
+                      label="Faces, edges or/and solids"
+                      icon=""
+                      tooltip="Select objects"
+                      shape_types="edges faces solids"
+                      use_choice="false"
+                      concealment="true">
+          <validator id="PartSet_DifferentObjects"/>
+          <validator id="FeaturesPlugin_ValidatorFilletSelection"/>
+          </multi_selector>
           <multiradiuscurv-panel id="array_point_radius_by_point"
             filter_points="false">
             <validator id="GeomValidators_ShapeType" parameters="empty,vertex"/>