Selection filter definition This class builds up a type/count tree out of a string to test very fast a selection or object/subelement type against it. More...
#include <SelectionFilter.h>
Public Member Functions | |
void | addError (const char *e) |
bool | isValid (void) const |
true if a valid filter is set | |
bool | match (void) |
Test to current selection This method tests the current selection set against the filter and returns true if the described object(s) are selected. | |
SelectionFilter (const std::string &filter) | |
SelectionFilter (const char *filter) | |
Constructs a SelectionFilter object. | |
void | setFilter (const char *filter) |
Set a new filter string. | |
bool | test (App::DocumentObject *pObj, const char *sSubName) |
Test objects This method tests if a given object is described in the filter. | |
virtual | ~SelectionFilter () |
Public Attributes | |
std::vector< std::vector < SelectionObject > > | Result |
Protected Member Functions | |
bool | parse (void) |
Protected Attributes | |
Node_Block * | Ast |
std::string | Errors |
std::string | Filter |
Friends | |
class | SelectionSingleton |
Selection filter definition This class builds up a type/count tree out of a string to test very fast a selection or object/subelement type against it.
Example strings are: "SELECT Part::Feature SUBELEMENT Edge", "SELECT Robot::RobotObject", "SELECT Robot::RobotObject COUNT 1..5"
Definition at line 49 of file SelectionFilter.h.
SelectionFilter::SelectionFilter | ( | const char * | filter | ) |
Constructs a SelectionFilter object.
Definition at line 76 of file SelectionFilter.cpp.
References setFilter().
SelectionFilter::SelectionFilter | ( | const std::string & | filter | ) |
Definition at line 82 of file SelectionFilter.cpp.
References setFilter().
SelectionFilter::~SelectionFilter | ( | ) | [virtual] |
Definition at line 101 of file SelectionFilter.cpp.
void SelectionFilter::addError | ( | const char * | e | ) |
bool Gui::SelectionFilter::isValid | ( | void | ) | const [inline] |
true if a valid filter is set
Definition at line 80 of file SelectionFilter.h.
bool SelectionFilter::match | ( | void | ) |
Test to current selection This method tests the current selection set against the filter and returns true if the described object(s) are selected.
Definition at line 105 of file SelectionFilter.cpp.
References Ast, Gui::SelectionSingleton::getSelectionEx(), Py::int, KDL::max(), zipios::min(), Gui::Node_Block::Objects, Result, and Gui::Selection().
Referenced by CmdRobotTrajectoryCompound::activated(), CmdRobotTrajectoryDressUp::activated(), CmdRobotEdge2Trac::activated(), CmdSketcherMapSketch::activated(), CmdSketcherNewSketch::activated(), CmdRobotSimulate::activated(), CmdRobotRestoreHomePos::activated(), CmdRobotSetHomePos::activated(), CmdPartRuledSurface::activated(), Gui::SelectionFilterPy::match(), RobotGui::TaskWatcherRobot::shouldShow(), Gui::TaskView::TaskWatcherCommands::shouldShow(), and Gui::TaskView::TaskWatcherPython::shouldShow().
bool SelectionFilter::parse | ( | void | ) | [protected] |
Definition at line 293 of file SelectionFilter.cpp.
References Ast, Errors, Filter, and yyparse.
Referenced by setFilter().
void SelectionFilter::setFilter | ( | const char * | filter | ) |
Set a new filter string.
Definition at line 88 of file SelectionFilter.cpp.
References Ast, Errors, Filter, and parse().
Referenced by SelectionFilter(), and Gui::TaskView::TaskWatcherPython::TaskWatcherPython().
bool SelectionFilter::test | ( | App::DocumentObject * | pObj, | |
const char * | sSubName | |||
) |
Test objects This method tests if a given object is described in the filter.
If SubName is not NULL the Subelement gets also tested.
Definition at line 148 of file SelectionFilter.cpp.
References Ast, App::PropertyContainer::getTypeId(), Base::Type::isDerivedFrom(), and Gui::Node_Block::Objects.
Referenced by Gui::SelectionFilterGate::allow(), and Gui::SelectionFilterPy::test().
friend class SelectionSingleton [friend] |
Definition at line 75 of file SelectionFilter.h.
Node_Block* Gui::SelectionFilter::Ast [protected] |
Definition at line 87 of file SelectionFilter.h.
Referenced by match(), parse(), setFilter(), and test().
std::string Gui::SelectionFilter::Errors [protected] |
Definition at line 84 of file SelectionFilter.h.
Referenced by addError(), parse(), and setFilter().
std::string Gui::SelectionFilter::Filter [protected] |
Definition at line 83 of file SelectionFilter.h.
Referenced by parse(), setFilter(), and Gui::TaskView::TaskWatcherPython::shouldShow().
std::vector<std::vector<SelectionObject> > Gui::SelectionFilter::Result |
Definition at line 77 of file SelectionFilter.h.
Referenced by CmdRobotTrajectoryCompound::activated(), CmdRobotTrajectoryDressUp::activated(), CmdRobotEdge2Trac::activated(), CmdSketcherMapSketch::activated(), CmdSketcherNewSketch::activated(), CmdRobotSimulate::activated(), CmdRobotRestoreHomePos::activated(), CmdRobotSetHomePos::activated(), CmdPartRuledSurface::activated(), match(), Gui::SelectionFilterPy::result(), and RobotGui::TaskWatcherRobot::shouldShow().