#include <ModelAPI_Events.h>
#include <ModelAPI_ResultConstruction.h>
+#include <Config_WidgetAPI.h>
+
#include <TopoDS_Iterator.hxx>
ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData)
-: ModuleBase_WidgetValidated(theParent, theWorkshop, theData)
+: ModuleBase_WidgetValidated(theParent, theWorkshop, theData),
+myIsPointsFiltering(true)
{
+ QString aFiltering = QString::fromStdString(theData->getProperty("filter_points"));
+ if (aFiltering.toLower() == "false")
+ myIsPointsFiltering = false;
}
//********************************************************************
{
ModuleBase_ISelection* aSelection = myWorkshop->selection();
theObject = aSelection->getResult(thePrs);
+ if (!theObject.get())
+ theObject = thePrs->object();
theShape = aSelection->getShape(thePrs);
}
{
QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
// equal vertices should not be used here
- ModuleBase_ISelection::filterSelectionOnEqualPoints(aSelected);
+ if (myIsPointsFiltering)
+ ModuleBase_ISelection::filterSelectionOnEqualPoints(aSelected);
bool isDone = setSelection(aSelected, true/*false*/);
updateOnSelectionChanged(isDone);
return aValid;
}
// when the SHAPE type is provided by XML as Object, the whole result shape should be selected.
- if (!aShape.get() && aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) {
+ //if (!aShape.get() && aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) {
+ // In case of selection of a feature aShape could be not NULL, but result has to be selected
+ if (aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) {
aValid = true;
return aValid;
}
}
//********************************************************************
-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();
aSelectAttr->removeTemporaryValues();
}
}
-
-//********************************************************************
-std::string ModuleBase_WidgetSelector::generateName(const AttributePtr& theAttribute,
- ModuleBase_IWorkshop* theWorkshop)
-{
- std::string aName;
- if (theAttribute.get() != NULL) {
- ModuleBase_Operation* anOperation = theWorkshop->currentOperation();
-
- FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
- if (aFeature.get()) {
- std::string aXmlCfg, aDescription;
- theWorkshop->module()->getXMLRepresentation(aFeature->getKind(), aXmlCfg, aDescription);
-
- ModuleBase_WidgetFactory aFactory(aXmlCfg, theWorkshop);
- std::string anAttributeTitle;
- aFactory.getAttributeTitle(theAttribute->id(), anAttributeTitle);
-
- std::stringstream aStreamName;
- aStreamName << theAttribute->owner()->data()->name() << "/"<< anAttributeTitle.c_str();
- aName = aStreamName.str();
- }
- }
- return aName;
-}