From: nds Date: Mon, 22 Jun 2015 12:55:22 +0000 (+0300) Subject: 1. Compound selection choice is provided for sketch selection in Extrusion operation... X-Git-Tag: V_1.3.0~216 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=43264762f9e56ebf7a687b6ca43a86e500224f2e;p=modules%2Fshaper.git 1. Compound selection choice is provided for sketch selection in Extrusion operation. This type selection happens by selecting a sketch in ObjectBrowser. The widget selector acceptSubShapes() method is corrected to check shape type of the selected result. It is necessary always, for example in Sketch operation start Translate operation and click on a plane in ObjectBrowser. 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. --- diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index a3b3702bd..76e185dac 100644 --- a/src/FeaturesPlugin/extrusion_widget.xml +++ b/src/FeaturesPlugin/extrusion_widget.xml @@ -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"> diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 2deb05c7c..6728d2349 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -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)) diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index 81f84dda6..74304a35c 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -7,6 +7,7 @@ #include "ModuleBase_ViewerFilters.h" #include "ModuleBase_IWorkshop.h" +#include "ModuleBase_IModule.h" #include #include @@ -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()); diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index c8bdba34e..946bfa116 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -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 { diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index b1195e3e8..921140887 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -163,7 +163,7 @@ protected: /// Variable of GeomSelection QList mySelection; - //bool myIsUseChoice; + bool myIsUseChoice; }; #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index f15479dd5..5a9ce330a 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -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(); aValid = acceptSubShape(aTopoShape); diff --git a/src/PartSet/PartSet_Filters.cpp b/src/PartSet/PartSet_Filters.cpp index d5df8871c..85038b426 100644 --- a/src/PartSet/PartSet_Filters.cpp +++ b/src/PartSet/PartSet_Filters.cpp @@ -7,6 +7,7 @@ #include "PartSet_Filters.h" #include +#include "ModuleBase_IModule.h" #include #include @@ -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 = diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index c5852a61c..dc3840258 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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 diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index f4b2b978c..8a469e9bd 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -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