It was possible to select an extrusion result in OB for a new created extrusion.
/// \param theFilter a selection filter
virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
+ /// Returns true if the selection filter is set to the viewer
+ /// \param theFilter a selection filter
+ virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0;
+
/// Remove all selection filters from the viewer
virtual void clearSelectionFilters() = 0;
bool isActivated = false;
Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter();
+ ModuleBase_IViewer* aViewer = myWorkshop->viewer();
- const SelectMgr_ListOfFilter& aFilters = myWorkshop->viewer()->AISContext()->Filters();
- SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
- for (; aIt.More(); aIt.Next()) {
- if (aSelFilter.Access() == aIt.Value().Access())
- isActivated = true;
- }
- return isActivated;
+ return aViewer->hasSelectionFilter(aSelFilter);
}
-
void ModuleBase_WidgetValidated::activateFilters(const bool toActivate)
{
ModuleBase_IViewer* aViewer = myWorkshop->viewer();
#include <SUIT_ViewManager.h>
+#include <SelectMgr_ListIteratorOfListOfFilter.hxx>
+
#include <QMouseEvent>
#include <QContextMenuEvent>
}
}
+//***************************************
+bool NewGeom_SalomeViewer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
+{
+ bool aFoundFilter = false;
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (!aContext.IsNull()) {
+ const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
+ SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
+ for (; aIt.More() && !aFoundFilter; aIt.Next()) {
+ aFoundFilter = theFilter.Access() == aIt.Value().Access();
+ }
+ }
+ return aFoundFilter;
+}
+
//***************************************
void NewGeom_SalomeViewer::clearSelectionFilters()
{
/// Remove selection filter from the viewer
virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+ /// Returns true if the selection filter is set to the viewer
+ /// \param theFilter a selection filter
+ virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+
/// Remove all selection filters from the viewer
virtual void clearSelectionFilters();
void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
- if (aContext.IsNull())
+ if (aContext.IsNull() || hasSelectionFilter(theFilter))
return;
- const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
- SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
- for (; aIt.More(); aIt.Next()) {
- if (theFilter.Access() == aIt.Value().Access())
- return;
- }
+
Handle(SelectMgr_CompositionFilter) aCompFilter = GetFilter();
- const SelectMgr_ListOfFilter& aStoredFilters = aCompFilter->StoredFilters();
- for (aIt.Initialize(aStoredFilters); aIt.More(); aIt.Next()) {
- if (theFilter.Access() == aIt.Value().Access())
- return;
- }
aCompFilter->Add(theFilter);
#ifdef DEBUG_SELECTION_FILTERS
int aCount = GetFilter()->StoredFilters().Extent();
#endif
}
+bool XGUI_Displayer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
+{
+ bool aFilterFound = false;
+
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (aContext.IsNull())
+ return aFilterFound;
+ const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
+ SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
+ for (; aIt.More() && !aFilterFound; aIt.Next()) {
+ if (theFilter.Access() == aIt.Value().Access())
+ aFilterFound = true;
+ }
+ Handle(SelectMgr_CompositionFilter) aCompFilter = GetFilter();
+ const SelectMgr_ListOfFilter& aStoredFilters = aCompFilter->StoredFilters();
+ for (aIt.Initialize(aStoredFilters); aIt.More() && !aFilterFound; aIt.Next()) {
+ if (theFilter.Access() == aIt.Value().Access())
+ aFilterFound = true;
+ }
+ return aFilterFound;
+}
+
void XGUI_Displayer::removeFilters()
{
Handle(AIS_InteractiveContext) aContext = AISContext();
/// \param theFilter a filter instance
void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+ /// Returns true if the selection filter is set to the viewer
+ /// \param theFilter a selection filter
+ virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+
/// Remove all selection filters
void removeFilters();
myWorkshop->displayer()->removeSelectionFilter(theFilter);
}
+//***************************************
+bool XGUI_ViewerProxy::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
+{
+ return myWorkshop->displayer()->hasSelectionFilter(theFilter);
+}
+
//***************************************
void XGUI_ViewerProxy::clearSelectionFilters()
{
/// Remove selection filter from the viewer
virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+ /// Returns true if the selection filter is set to the viewer
+ /// \param theFilter a selection filter
+ virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter);
+
/// Remove all selection filters from the viewer
virtual void clearSelectionFilters();