Salome HOME
1. Compound selection choice is provided for sketch selection in Extrusion operation...
authornds <natalia.donis@opencascade.com>
Mon, 22 Jun 2015 12:55:22 +0000 (15:55 +0300)
committernds <natalia.donis@opencascade.com>
Mon, 22 Jun 2015 12:55:22 +0000 (15:55 +0300)
2. Document shape filter check whether the operation is started itself. This improvement is similar to the infinite filter using. The matter is that the nested operation stop should not remove the filter from the context. If it is happened, objects from out parts is selected in sketch operation after, for example, translate operation stop. So, it seems that it is a best decision to check the active operation availability in the filter.

src/FeaturesPlugin/extrusion_widget.xml
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_ViewerFilters.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/PartSet/PartSet_Filters.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h

index a3b3702bd6bcba3fd4e0a55435a710a0a640d365..76e185daccf81621a29c3e6fcd1a99061e6dca84 100644 (file)
@@ -5,7 +5,8 @@
     label="Select a sketch face"
     icon=":icons/sketch.png"
     tooltip="Select a sketch face"
-    type_choice="Faces">
+    use_choice="false"
+    type_choice="Faces Compound">
     <validator id="PartSet_SketchEntityValidator" parameters="Sketch"/>
   </multi_selector>
   <groupbox title="From">
index 2deb05c7c5206d77ddb3e441fe867f2770c77955..6728d2349f657bae509228e2cf0374016ba16e95 100644 (file)
@@ -204,6 +204,7 @@ TopAbs_ShapeEnum shapeType(const QString& theType)
     MyShapeTypes["shell"] = TopAbs_SHELL;
     MyShapeTypes["solid"] = TopAbs_SOLID;
     MyShapeTypes["solids"] = TopAbs_SOLID;
+    MyShapeTypes["compound"] = TopAbs_COMPOUND;
   }
   QString aType = theType.toLower();
   if (MyShapeTypes.contains(aType))
index 81f84dda6641d9c604cbac02c90ef19374fd4ecb..74304a35c790c4f03bafe2d3b814cff102d091a9 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "ModuleBase_ViewerFilters.h"
 #include "ModuleBase_IWorkshop.h"
+#include "ModuleBase_IModule.h"
 
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Document.h>
@@ -29,6 +30,12 @@ IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter);
 //TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340)
 Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
 {
+  ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+  // the shapes from different documents should be provided if there is no started operation
+  // in order to show/hide results
+  if (!anOperation)
+    return true;
+
   if (theOwner->HasSelectable()) {
     Handle(AIS_InteractiveObject) aAisObj = 
       Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
index c8bdba34ed689906aeab7ee7145c78d9226ba632..946bfa116925e8d3a895e9fc047cdffafb7fa52d 100644 (file)
@@ -57,12 +57,12 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
   QString aTypesStr = aPropertyTypes.c_str();
   QStringList aShapeTypes = aTypesStr.split(' ');
 
-  //myIsUseChoice = theData->getBooleanAttribute("use_choice", true);
+  myIsUseChoice = theData->getBooleanAttribute("use_choice", true);
 
   myTypeCombo->addItems(aShapeTypes);
   aMainLay->addWidget(myTypeCombo, 0, 1);
   // if the xml definition contains one type, the controls to select a type should not be shown
-  if (aShapeTypes.size() == 1/* || !myIsUseChoice*/) {
+  if (aShapeTypes.size() == 1 || !myIsUseChoice) {
     aTypeLabel->setVisible(false);
     myTypeCombo->setVisible(false);
   }
@@ -298,7 +298,7 @@ QIntList ModuleBase_WidgetMultiSelector::getShapeTypes() const
 {
   QIntList aShapeTypes;
 
-  if (myTypeCombo->count() > 1) {
+  if (myTypeCombo->count() > 1 && myIsUseChoice) {
     aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->currentText()));
   }
   else {
index b1195e3e81cce4e3d6fe558dd593ddadc9e8e6df..92114088774dc9bb2184a8be7900d51821d70596 100644 (file)
@@ -163,7 +163,7 @@ protected:
   /// Variable of GeomSelection
   QList<GeomSelection> mySelection;
 
-  //bool myIsUseChoice;
+  bool myIsUseChoice;
 };
 
 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */
index f15479dd5a6bbf7c8c23e99572652a8ca26aeb88..5a9ce330a929e931518f4052e3031af14a00b42c 100755 (executable)
@@ -108,11 +108,13 @@ void ModuleBase_WidgetSelector::activateCustom()
 bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
 {
   GeomShapePtr aShape = myWorkshop->selection()->getShape(thePrs);
-  bool aValid;
-  // if there is no selected shape, the method returns true
-  if (!aShape.get())
-    aValid = true;
-  else {
+  bool aValid = true;
+  if (!aShape.get()) {
+    ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
+    if (aResult.get())
+      aShape = aResult->shape();
+  }
+  if (aShape.get()) {
     // Check that the selection corresponds to selection type
     TopoDS_Shape aTopoShape = aShape->impl<TopoDS_Shape>();
     aValid = acceptSubShape(aTopoShape);
index d5df8871ceed90efe5702c36f73a1641c7ee58f1..85038b426b10801a788481489bc5a2df834c1f03 100644 (file)
@@ -7,6 +7,7 @@
 #include "PartSet_Filters.h"
 
 #include <ModuleBase_IWorkshop.h>
+#include "ModuleBase_IModule.h"
 
 #include <ModelAPI_Feature.h>
 #include <FeaturesPlugin_Group.h>
@@ -20,6 +21,12 @@ IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter)
 
 Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
 {
+  ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+  // the shapes from different documents should be provided if there is no started operation
+  // in order to show/hide results
+  if (!anOperation)
+    return true;
+
   if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
     if (theOwner->HasSelectable()) {
       Handle(AIS_InteractiveObject) aAisObj = 
index c5852a61c4d974688676604aa76afec5b3f9779e..dc38402585e2ed0ec4eeb15e7a8498182d09fd37 100644 (file)
@@ -128,6 +128,10 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
   Events_Loop* aLoop = Events_Loop::loop();
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
 
+  if (myDocumentShapeFilter.IsNull())
+    myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
+  myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
+
   if (myFilterInfinite.IsNull())
     myFilterInfinite = new PartSet_FilterInfinite();
   myWorkshop->viewer()->addSelectionFilter(myFilterInfinite);
@@ -232,16 +236,6 @@ void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation)
   breakOperationSequence();
 }
 
-void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
-{
-  // Install the document filter before any other filter
-  if (myDocumentShapeFilter.IsNull())
-    myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
-  myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
-
-  ModuleBase_IModule::sendOperation(theOperation);
-}
-
 void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
 {
   if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
@@ -265,7 +259,7 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
   else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
     mySketchMgr->stopNestedSketch(theOperation);
   }
-  myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
+  //myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
 }
 
 ModuleBase_Operation* PartSet_Module::currentOperation() const
index f4b2b978cba07dc2308d29a4f2f6ed2cd4135b71..8a469e9bd97e64d38c21e301ee2e7ebf6b600f68 100644 (file)
@@ -139,10 +139,6 @@ public:
   /// \param theObjectBrowser a pinter on Object Browser widget
   virtual void customizeObjectBrowser(QWidget* theObjectBrowser);
 
-  /// Sends the operation for launching
-  /// \param theOperation the operation
-  virtual void sendOperation(ModuleBase_Operation* theOperation);
-
 public slots:
   /// SLOT, that is called by no more widget signal emitted by property panel
   /// Set a specific flag to restart the sketcher operation