]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3236: Add buttons for shape type choice
authorvsv <vsv@opencascade.com>
Wed, 24 Jun 2020 17:46:05 +0000 (20:46 +0300)
committervsv <vsv@opencascade.com>
Wed, 24 Jun 2020 17:46:17 +0000 (20:46 +0300)
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_Extrusion.h
src/FeaturesPlugin/extrusion_widget.xml
src/PartSet/PartSet_WidgetSketchCreator.cpp

index 57b1ba874b20897df91b6a0d5875b18093f244c9..6ae36c31a79d9498615ef4fd3a4352e5027a5482 100644 (file)
@@ -23,6 +23,7 @@
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 
@@ -57,6 +58,8 @@ void FeaturesPlugin_Extrusion::initAttributes()
 
   data()->addAttribute(DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
 
+  data()->addAttribute(USE_SHAPES_ID(), ModelAPI_AttributeInteger::typeId());
+
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), DIRECTION_OBJECT_ID());
index 1f657b30afceb5c7af7bcd94abf75c76f4300ce6..91a30f16d32237c7d8f63b47b73e4c092f308594 100644 (file)
@@ -123,6 +123,13 @@ public:
     return MY_FROM_OFFSET_ID;
   }
 
+  /// Attribute name of using shape types.
+  inline static const std::string& USE_SHAPES_ID()
+  {
+    static const std::string MY_USE_SHAPEST_ID("use_sapes");
+    return MY_USE_SHAPEST_ID;
+  }
+
   /// \return the kind of a feature.
   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
   {
index 85ca64d7198d8bbaaf203c57c783fe887542df30..7d833c09532cada1ad5c219b1c71604f2bec1b32 100644 (file)
@@ -8,6 +8,15 @@
                    shape_types="vertices edges wires faces shells solids compsolids compounds">
     <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
   </sketch_launcher>
+  <choice id="use_sapes"
+    widget_type="radiobuttons"
+    buttons_dir="horizontal"
+    label="Type"
+    tooltip="Using shapes type"
+    string_list="Vertices Edges Faces"
+    icons_list=":pictures/vertex32.png :pictures/edge32.png :pictures/face32.png"
+    default="2">
+  </choice>
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
index de888dc755b59345e113b6dda7c47620de5435f8..9d6d90cf2dffd5f60023ca1504a07f0841cf5c26 100644 (file)
@@ -212,6 +212,9 @@ void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelec
   XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
   const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
   foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
+    QString aType(aWidget->metaObject()->className());
+    if (aType == "ModuleBase_WidgetChoice")
+      continue;
     if (theSelectionControl) { // hide other controls
       if (aWidget != this)
         aWidget->setVisible(false);