Add/remove the current filters to the shape selection widget by activate/deactivate operation.
*/
}
-void ModuleBase_FilterFactory::validators(const std::string& theFeatureID,
- std::list<ModuleBase_Filter*>& theResult,
- std::list<std::list<std::string> >& theArguments) const
+const SelectMgr_ListOfFilter& ModuleBase_FilterFactory::filters(const std::string& theFeatureID,
+ const std::string& theAttrID/*,
+ std::list<ModuleBase_Filter*>& theFilters/*,
+ std::list<std::list<std::string> >& theArguments*/) const
{
-/* std::map<std::string, AttrValidators>::const_iterator aFeature = myFeatures.find(theFeatureID);
- if (aFeature != myFeatures.cend()) {
- AttrValidators::const_iterator aValIter = aFeature->second.cbegin();
- for (; aValIter != aFeature->second.cend(); aValIter++) {
- std::map<std::string, ModuleBase_Filter*>::const_iterator aFound =
- myIDs.find(aValIter->first);
- if (aFound == myIDs.end()) {
- Events_Error::send(std::string("Validator ") + aValIter->first + " was not registered");
- } else {
- theResult.push_back(aFound->second);
- theArguments.push_back(aValIter->second);
- }
- }
- }
- addDefaultValidators(theResult);*/
-}
-
-void ModuleBase_FilterFactory::validators(const std::string& theFeatureID,
- const std::string& theAttrID,
- std::list<ModuleBase_Filter*>& theValidators,
- std::list<std::list<std::string> >& theArguments) const
-{
-/* std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeature =
+ SelectMgr_ListOfFilter aFilters;
+ return aFilters;
+ /* std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeature =
myAttrs.find(theFeatureID);
if (aFeature != myAttrs.cend()) {
std::map<std::string, AttrValidators>::const_iterator anAttr = aFeature->second.find(theAttrID);
#include "ModuleBase.h"
#include "ModuleBase_IWorkshop.h"
+#include <SelectMgr_ListOfFilter.hxx>
+
#include <map>
#include <set>
const std::string& theFeatureID,
const std::string& theAttrID);
- /// Provides a validator for the feature, returns NULL if no validator
- MODULEBASE_EXPORT virtual void validators(const std::string& theFeatureID,
- std::list<ModuleBase_Filter*>& theResult,
- std::list<std::list<std::string> >& theArguments) const;
/// Provides a validator for the attribute, returns NULL if no validator
- MODULEBASE_EXPORT virtual void validators(const std::string& theFeatureID,
- const std::string& theAttrID,
- std::list<ModuleBase_Filter*>& theValidators,
- std::list<std::list<std::string> >& theArguments) const;
+ MODULEBASE_EXPORT const SelectMgr_ListOfFilter& filters(const std::string& theFeatureID,
+ const std::string& theAttrID) const;
/// Returns registered validator by its Id
MODULEBASE_EXPORT virtual const ModuleBase_Filter* validator(const std::string& theID) const;
#include <ModuleBase_IWorkshop.h>
#include <ModuleBase_IViewer.h>
#include <ModuleBase_Tools.h>
+#include <ModuleBase_FilterFactory.h>
+#include <ModuleBase_Filter.h>
#include <Config_WidgetAPI.h>
#include <Events_Loop.h>
#include <GeomAPI_Shape.h>
+#include <SelectMgr_ListIteratorOfListOfFilter.hxx>
#include <TopoDS_Shape.hxx>
#include <TopExp_Explorer.hxx>
return;
myIsActive = toActivate;
updateSelectionName();
+ ModuleBase_IViewer* aViewer = myWorkshop->viewer();
if (myIsActive) {
connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
myWorkshop->activateSubShapesSelection(aList);
if (!myObjectTypes.isEmpty()) {
myObjTypeFilter = new ModuleBase_ObjectTypesFilter(myWorkshop, myObjectTypes);
- myWorkshop->viewer()->clearSelectionFilters();
- myWorkshop->viewer()->addSelectionFilter(myObjTypeFilter);
+ aViewer->clearSelectionFilters();
+ aViewer->addSelectionFilter(myObjTypeFilter);
}
}
} else {
disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
if (myUseSubShapes) {
if (!myObjTypeFilter.IsNull()) {
- myWorkshop->viewer()->removeSelectionFilter(myObjTypeFilter);
+ aViewer->removeSelectionFilter(myObjTypeFilter);
myObjTypeFilter.Nullify();
}
myWorkshop->deactivateSubShapesSelection();
}
}
+
+ ModuleBase_FilterFactory* aFactory = myWorkshop->selectionFilters();
+ const SelectMgr_ListOfFilter& aFilters = aFactory->filters(parentID(), attributeID());
+ SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
+ for (; aIt.More(); aIt.Next()) {
+ Handle(ModuleBase_Filter) aFilter = Handle(ModuleBase_Filter)::DownCast(aIt.Value());
+ if (myIsActive)
+ aViewer->addSelectionFilter(aFilter);
+ else
+ aViewer->removeSelectionFilter(aFilter);
+ }
}
//********************************************************************