-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "PartSet_Filters.h"
#include <ModelAPI_Feature.h>
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_ResultGroup.h>
+#include <ModelAPI_ResultField.h>
#include <ModelAPI_Session.h>
#include <AIS_InteractiveObject.hxx>
IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
+PartSet_GlobalFilter::PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop)
+ : ModuleBase_ShapeDocumentFilter(theWorkshop)
+{
+ addNonSelectableType(ModelAPI_ResultField::group().c_str());
+ addNonSelectableType(ModelAPI_ResultGroup::group().c_str());
+}
+
+
Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
bool aValid = true;
// result of parts belongs to PartSet document and can be selected only when PartSet
// is active in order to do not select the result of the active part.
if (aResult.get()) {
- if (aResult->groupName() == ModelAPI_ResultPart::group()) {
+ std::string aResultGroupName = aResult->groupName();
+ if (aResultGroupName == ModelAPI_ResultPart::group()) {
SessionPtr aMgr = ModelAPI_Session::get();
aValid = aMgr->activeDocument() == aMgr->moduleDocument();
- } else if (aResult->groupName() == ModelAPI_ResultGroup::group()) {
+ } else if (myNonSelectableTypes.contains(aResultGroupName.c_str())) {
aValid = Standard_False;
} else
aValid = Standard_True;
// only and there can not be Group feature
FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
if (aFeature) {
- aValid = aFeature->getKind() != "Group";
+ aValid = !myNonSelectableTypes.contains(aFeature->getKind().c_str());
} else
aValid = Standard_True;
}
myGroupNames = theGroupNames;
}
-Standard_Boolean PartSet_ResultGroupNameFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+Standard_Boolean PartSet_ResultGroupNameFilter::IsOk(
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
{
std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
if (theOwner->HasSelectable()) {