//**********************************************************************************
void CollectionPlugin_WidgetField::onShapeTypeChanged(int theType)
{
- activateSelectionAndFilters(theType == 5? false:true);
+ updateSelectionModesAndFilters(theType == 5? false:true);
AttributeSelectionListPtr aSelList =
myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
virtual ~ModuleBase_IModule() {}
- /// Appends into container of workshop selection filters
- /// \param [out] selection filters
- virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const {}
-
- /// Returns current selection modes that should be used in 3D viewer
- /// \param theModes container of modes
- virtual void selectionModes(QIntList& theModes) const {}
-
/// Stores the current selection
virtual void storeSelection() {}
virtual void activeSelectionModes(QIntList& theModes) {}
/// Appends specific selection modes for the module to the list of types
+ /// \param theModesType combination of available selection filters
/// \param theModes a selection modes to be extended
- virtual void customSubShapesSelectionModes(QIntList& theModes) {}
+ virtual void moduleSelectionModes(int theModesType, QIntList& theModes) = 0;
+
+ /// Appends into container of filters module filters corresponded to the modes type
+ /// \param theModesType combination of available selection filters
+ /// \param theSelectionFilters [out] container to be extend by elements
+ virtual void moduleSelectionFilters(int theModesType,
+ SelectMgr_ListOfFilter& theSelectionFilters) = 0;
/// Return true if the custom presentation is activated
/// \param theFlag a flag of level of customization, which means that only part of sub-elements
}
//**************************************************************
-void ModuleBase_ModelWidget::selectionModes(QIntList& theModes, bool& isAdditional)
+void ModuleBase_ModelWidget::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
{
- isAdditional = true;
+ theModuleSelectionModes = -1;
if (myWidgetValidator)
- myWidgetValidator->selectionModes(theModes, isAdditional);
+ myWidgetValidator->selectionModes(theModuleSelectionModes, theModes);
}
//**************************************************************
-void ModuleBase_ModelWidget::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void ModuleBase_ModelWidget::selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters)
{
+ theModuleSelectionFilters = -1;
if (myWidgetValidator)
- myWidgetValidator->selectionFilters(theSelectionFilters);
+ myWidgetValidator->selectionFilters(theModuleSelectionFilters, theSelectionFilters);
}
//**************************************************************
bool isInitialized(ObjectPtr theObject) const;
/// Fills given container with selection modes if the widget has it
- /// \param theModes [out] a container of modes
- /// \param isAdditional if true, the modes are combinated with the module ones
- virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+ /// \param [out] theModes a container of modes
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
/// Appends into container of workshop selection filters
- /// \param [out] selection filters
- virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+ /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
+ /// \param [out] theSelectionFilters selection filters
+ virtual void selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters);
/// Returns true, if default value of the widget should be computed
/// on operation's execute, like radius for circle's constraint (can not be zero)
}
//********************************************************************
-void ModuleBase_WidgetFeatureSelector::selectionModes(QIntList& theModes, bool& isAdditional)
+void ModuleBase_WidgetFeatureSelector::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
{
+ theModuleSelectionModes = -1;
theModes.push_back(ModuleBase_ResultPrs::Sel_Result);
- isAdditional = true;
}
//********************************************************************
const bool theToValidate);
/// Fills given container with selection modes if the widget has it
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
/// \param theModes [out] a container of modes
- /// \param isAdditional if true, the modes are combinated with the module ones
- virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
/// Returns list of widget controls
/// \return a control list
}
//********************************************************************
-void ModuleBase_WidgetMultiSelector::activateSelectionAndFilters(bool toActivate)
+void ModuleBase_WidgetMultiSelector::updateSelectionModesAndFilters(bool toActivate)
{
myWorkshop->updateCommandStatus(); // update enable state of Undo/Redo application actions
- ModuleBase_WidgetSelector::activateSelectionAndFilters(toActivate);
+ ModuleBase_WidgetSelector::updateSelectionModesAndFilters(toActivate);
}
//********************************************************************
//********************************************************************
void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
{
- activateSelectionAndFilters(true);
+ updateSelectionModesAndFilters(true);
myWorkshop->selectionActivate()->updateSelectionModes();
if (!myFeature)
aShapeTypeName = myTypeCombo->itemText(idx);
int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
- activateSelectionAndFilters(false);
+ updateSelectionModesAndFilters(false);
bool isBlocked = myTypeCombo->blockSignals(true);
myTypeCombo->setCurrentIndex(idx);
myTypeCombo->blockSignals(isBlocked);
- activateSelectionAndFilters(true);
+ updateSelectionModesAndFilters(true);
break;
}
}
const ActionParamPtr& theParam = ActionParamPtr());
/// Activate or deactivate selection and selection filters
- virtual void activateSelectionAndFilters(bool toActivate);
+ virtual void updateSelectionModesAndFilters(bool toActivate);
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
}
//********************************************************************
-void ModuleBase_WidgetSelector::selectionModes(QIntList& theModes, bool& isAdditional)
+void ModuleBase_WidgetSelector::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
{
+ theModuleSelectionModes = -1;
theModes.append(getShapeTypes());
- isAdditional = true;
}
//********************************************************************
-void ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
+void ModuleBase_WidgetSelector::updateSelectionModesAndFilters(bool toActivate)
{
updateSelectionName();
virtual ~ModuleBase_WidgetSelector();
/// Fills given container with selection modes if the widget has it
- /// \param theModes [out] a container of modes
- /// \param isAdditional if true, the modes are combinated with the module ones
- virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+ /// \param [out] theModes a container of modes
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
/// Defines if it is supposed that the widget should interact with the viewer.
virtual bool isViewerSelector() { return true; }
/// Activate or deactivate selection and selection filters
- virtual void activateSelectionAndFilters(bool toActivate);
+ virtual void updateSelectionModesAndFilters(bool toActivate);
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
// it is not yet activated, so we need to activate/deactivate it manually
bool isActivated = isFilterActivated();
if (!isActivated) {
+ int aModuleSelectionFilters = -1;
SelectMgr_ListOfFilter aSelectionFilters;
- selectionFilters(aSelectionFilters);
+ selectionFilters(aModuleSelectionFilters, aSelectionFilters);
/// after validation, the selection filters should be restored
myWorkshop->selectionActivate()->activateSelectionFilters(aSelectionFilters);
}
}
if (!isActivated)
{
+ // reset filters set in activateSelectionFilters above
myWorkshop->selectionActivate()->updateSelectionFilters();
clearValidatedCash();
}
}
//********************************************************************
-void ModuleBase_WidgetValidated::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void ModuleBase_WidgetValidated::selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters)
{
+ theModuleSelectionFilters = -1;
theSelectionFilters.Append(myWorkshop->validatorFilter());
}
bool isFilterActivated() const;
/// Appends into container of workshop selection filters
+ /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
/// \param [out] selection filters
- virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+ virtual void selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters);
/// Block the model flush of update and intialization of attribute
/// \param theAttribute an attribute of blocking
}
//********************************************************************
-void ModuleBase_WidgetValidator::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void ModuleBase_WidgetValidator::selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters)
{
+ theModuleSelectionFilters = -1;
theSelectionFilters.Append(myWorkshop->validatorFilter());
}
virtual ~ModuleBase_WidgetValidator();
/// Fills given container with selection modes if the widget has it
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
/// \param theModes [out] a container of modes
- /// \param isAdditional if true, the modes are combinated with the module ones
- virtual void selectionModes(QIntList& theModes, bool& isAdditional) {}
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes) {}
/// Appends into container of workshop selection filters
+ /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
/// \param [out] selection filters
- virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+ virtual void selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters);
/// Returns true if the validation is activated
bool isInValidate() const { return myIsInValidate; }
return aCanActivate;
}
-//******************************************************
-void PartSet_Module::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const
-{
- for (SelectMgr_ListOfFilter::Iterator aFiltersIt(mySelectionFilters); aFiltersIt.More();
- aFiltersIt.Next())
- theSelectionFilters.Append(aFiltersIt.Value());
-
- if (mySketchMgr->activeSketch())
- mySketchMgr->selectionFilters(theSelectionFilters);
-}
-
//******************************************************
bool PartSet_Module::addViewerMenu(const QMap<QString, QAction*>& theStdActions,
QWidget* theParent,
theModes = XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes();
}
+//******************************************************
+void PartSet_Module::moduleSelectionModes(int theModesType, QIntList& theModes)
+{
+ customSubShapesSelectionModes(theModes);
+
+ //theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes());
+ //myWorkshop->module()->activeSelectionModes(theModes);
+}
+
+//******************************************************
+void PartSet_Module::moduleSelectionFilters(int theModesType,
+ SelectMgr_ListOfFilter& theSelectionFilters)
+{
+ //XGUI_Tools::workshop(myWorkshop)->selectionFilters(theSelectionFilters);
+ //selectionFilters(theSelectionFilters);
+
+ for (SelectMgr_ListOfFilter::Iterator aFiltersIt(mySelectionFilters); aFiltersIt.More();
+ aFiltersIt.Next())
+ theSelectionFilters.Append(aFiltersIt.Value());
+
+ if (mySketchMgr->activeSketch())
+ mySketchMgr->selectionFilters(theSelectionFilters);
+}
+
//******************************************************
void PartSet_Module::customSubShapesSelectionModes(QIntList& theModes)
{
/// \param theObject a model object
virtual bool canActivateSelection(const ObjectPtr& theObject) const;
- /// Appends into container of workshop selection filters
- /// \param [out] selection filters
- virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const;
-
/// Add menu atems for object browser into the given menu
/// \param theMenu a popup menu to be shown in the object browser
virtual void addObjectBrowserMenu(QMenu* theMenu) const;
virtual void activeSelectionModes(QIntList& theModes);
/// Appends specific selection modes for the module to the list of types
+ /// \param theModesType combination of available selection filters
/// \param theModes a selection modes to be extended
- virtual void customSubShapesSelectionModes(QIntList& theModes);
+ virtual void moduleSelectionModes(int theModesType, QIntList& theModes);
+
+ /// Appends into container of filters module filters corresponded to the modes type
+ /// \param theModesType combination of available selection filters
+ /// \param theSelectionFilters [out] container to be extend by elements
+ virtual void moduleSelectionFilters(int theModesType,
+ SelectMgr_ListOfFilter& theSelectionFilters);
/// Returns whether the mouse enter the viewer's window
/// \return true if items are added and there is no necessity to provide standard menu
void onChoiceChanged(ModuleBase_ModelWidget* theWidget, int theIndex);
protected:
+ /// Appends specific selection modes for the module to the list of types
+ /// \param theModes a selection modes to be extended
+ virtual void customSubShapesSelectionModes(QIntList& theModes);
+
/// Sets the constraints states in internal map. If the feature kind is a dimensional constraint
/// other dimensions are shown.
/// \param theFeatureKindId a feature kind
theSelectionFilters.Append(myPlaneFilter);
}
-void PartSet_SketcherMgr::activatePlaneFilter(const bool& toActivate)
-{
- if (toActivate)
- myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter);
- else
- myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
-}
-
bool PartSet_SketcherMgr::operationActivatedByPreselection()
{
bool isOperationStopped = false;
/// \param [out] selection filters
virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const;
- /// Append the sketch plane filter into the current viewer
- /// \param toActivate state whether the filter should be activated/deactivated
- void activatePlaneFilter(const bool& toActivate);
-
/// Commit the operation if it is possible. If the operation is dimention constraint,
/// it gives widget editor to input dimention value
/// \return true if the operation is stopped after activation
// ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>
// (aFirstWidget);
// if (aWSelector) {
-// myWorkshop->selectionActivate()->activateSelectionAndFilters(aWSelector);
+// myWorkshop->selectionActivate()->updateSelectionModesAndFilters(aWSelector);
// }
// }
//}
}
//********************************************************************
-void PartSet_WidgetFeaturePointSelector::activateSelectionAndFilters(bool toActivate)
+void PartSet_WidgetFeaturePointSelector::updateSelectionModesAndFilters(bool toActivate)
{
#ifdef HIGHLIGHT_STAYS_PROBLEM
Handle(AIS_InteractiveContext) aContext =
#endif
- ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
+ ModuleBase_WidgetShapeSelector::updateSelectionModesAndFilters(toActivate);
}
//********************************************************************
/// Activate or deactivate selection and selection filters
/// \return true if the selection filter of the widget is activated in viewer context
- virtual void activateSelectionAndFilters(bool toActivate);
+ virtual void updateSelectionModesAndFilters(bool toActivate);
/// Set sketcher
/// \param theSketch a sketcher object
}
//********************************************************************
-void PartSet_WidgetPoint2D::selectionModes(QIntList& theModes, bool& isAdditional)
+void PartSet_WidgetPoint2D::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
{
+ theModuleSelectionModes = -1;
theModes << TopAbs_VERTEX;
theModes << TopAbs_EDGE;
- isAdditional = true;
}
//********************************************************************
virtual ~PartSet_WidgetPoint2D();
/// Fills given container with selection modes if the widget has it
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
/// \param theModes [out] a container of modes
- /// \param isAdditional if true, the modes are combinated with the module ones
- virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
/// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
}
//********************************************************************
-void PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
+void PartSet_WidgetShapeSelector::selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters)
{
- ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
+ ModuleBase_WidgetShapeSelector::selectionFilters(theModuleSelectionFilters, theSelectionFilters);
+
if (!myUseSketchPlane) {
- XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
- PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(aWorkshop->module());
- bool isUsePlaneFilterOnly = !toActivate;
- aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly);
+ theModuleSelectionFilters = -1; // TODO!!!
+
+ //XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
+ //PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(aWorkshop->module());
+ //bool isUsePlaneFilterOnly = !toActivate;
+ //aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly);
}
}
/// Retrurns installed sketcher
CompositeFeaturePtr sketch() const { return mySketch; }
- /// Activate or deactivate selection and selection filters
- /// \param toActivate boolean state whether it should be activated/deactivated
- virtual void activateSelectionAndFilters(bool toActivate);
+ /// Appends into container of workshop selection filters
+ /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
+ /// \param [out] theSelectionFilters selection filters
+ virtual void selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters);
protected:
/// Checks the widget validity. By default, it returns true.
myWorkshop->viewer()->update();
}
-void PartSet_WidgetSketchLabel::selectionModes(QIntList& theModes, bool& isAdditional)
+void PartSet_WidgetSketchLabel::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
{
+ theModuleSelectionModes = -1;
std::shared_ptr<GeomAPI_Pln> aPlane = plane();
if (!aPlane.get())
theModes << TopAbs_FACE;
- isAdditional = true;
}
-void PartSet_WidgetSketchLabel::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void PartSet_WidgetSketchLabel::selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters)
{
+ theModuleSelectionFilters = -1;
std::shared_ptr<GeomAPI_Pln> aPlane = plane();
if (aPlane.get())
return;
- return ModuleBase_WidgetValidated::selectionFilters(theSelectionFilters);
+ return ModuleBase_WidgetValidated::selectionFilters(theModuleSelectionFilters,
+ theSelectionFilters);
}
std::shared_ptr<GeomAPI_Dir>
const bool theToValidate);
/// Fills given container with selection modes if the widget has it
- // \param theModes [out] a container of modes
- /// \param isAdditional if true, the modes are combinated with the module ones
- virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+ /// \param theModes [out] a container of modes
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
/// Using widget selection filter only if plane is not defined.
+ /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
/// \param [out] selection filters
- virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+ virtual void selectionFilters(int& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters);
/// Returns list of widget controls
/// \return a control list
break;
case FacesPanel: {
XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionModes(aModes);
- myWorkshop->module()->customSubShapesSelectionModes(aModes); // avoid wire selection
+ myWorkshop->module()->moduleSelectionModes(-1/*all modes*/, aModes);
}
break;
default: break;
{
SelectMgr_ListOfFilter aSelectionFilters;
switch (activeSelectionPlace()) {
- case Workshop:
- XGUI_Tools::workshop(myWorkshop)->selectionFilters(aSelectionFilters);
+ case Workshop:
+ myWorkshop->module()->moduleSelectionFilters(-1/*all filters*/, aSelectionFilters);
break;
case PropertyPanel: {
ModuleBase_ModelWidget* anActiveWidget = myWorkshop->module()->activeWidget();
- getSelectionFilters(anActiveWidget, aSelectionFilters);
+ int aModuleSelectionFilters = -1;
+ if (anActiveWidget)
+ anActiveWidget->selectionFilters(aModuleSelectionFilters, aSelectionFilters);
+ myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
}
break;
case FacesPanel: {
- //XGUI_Tools::workshop(myWorkshop)->selectionFilters(aSelectionFilters);
XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionFilters(aSelectionFilters);
}
break;
if (!theWidget)
return;
- bool isAdditional = false;
- theWidget->selectionModes(theModes, isAdditional);
- if (isAdditional) {
- myWorkshop->module()->customSubShapesSelectionModes(theModes);
- //theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes());
- //myWorkshop->module()->activeSelectionModes(theModes);
- }
-}
-
-//**************************************************************
-void XGUI_SelectionActivate::getSelectionFilters(ModuleBase_ModelWidget* theWidget,
- SelectMgr_ListOfFilter& theSelectionFilters)
-{
- XGUI_Tools::workshop(myWorkshop)->selectionFilters(theSelectionFilters);
-
- if (theWidget)
- theWidget->selectionFilters(theSelectionFilters);
+ int aModuleSelectionModes = -1;
+ theWidget->selectionModes(aModuleSelectionModes, theModes);
+ myWorkshop->module()->moduleSelectionModes(aModuleSelectionModes, theModes);
}
//**************************************************************
/// \param theModes selection modes
void getSelectionModes(ModuleBase_ModelWidget* theWidget, QIntList& theModes);
- /// Returns selection filters of the widget
- /// \param theWidget model widget
- /// \param theSelectionFilters selection filters
- void getSelectionFilters(ModuleBase_ModelWidget* theWidget,
- SelectMgr_ListOfFilter& theSelectionFilters);
-
/// Returns Trihedron object if it is displayed
Handle(AIS_InteractiveObject) getTrihedron() const;
}
}
-//******************************************************
-void XGUI_Workshop::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
-{
- module()->selectionFilters(theSelectionFilters);
-}
-
//******************************************************
void XGUI_Workshop::onOperationResumed(ModuleBase_Operation* theOperation)
{
/// Returns defailt selection mode in 3d viewer
QIntList viewerSelectionModes() const { return myViewerSelMode; }
- /// Appends into container of workshop selection filters
- /// \param [out] selection filters
- void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
-
/// Highlights result objects in Object Browser according to
/// features found in the given list
void highlightResults(const QObjectPtrList& theObjects);