PartSet_WidgetPoint2dDistance.h
PartSet_WidgetShapeSelector.h
PartSet_OperationSketch.h
+ PartSet_Filters.h
)
SET(PROJECT_SOURCES
PartSet_WidgetPoint2dDistance.cpp
PartSet_WidgetShapeSelector.cpp
PartSet_OperationSketch.cpp
+ PartSet_Filters.cpp
)
SET(PROJECT_RESOURCES
${CMAKE_SOURCE_DIR}/src/GeomDataAPI
${CMAKE_SOURCE_DIR}/src/GeomAlgoAPI
${CMAKE_SOURCE_DIR}/src/SketchPlugin
+ ${CMAKE_SOURCE_DIR}/src/FeaturesPlugin
${CMAKE_SOURCE_DIR}/src/GeomAPI
${CAS_INCLUDE_DIRS}
${SUIT_INCLUDE}
--- /dev/null
+// File: PartSet_Filters.cpp
+// Created: 08 Nov 2014
+// Author: Vitaly SMETANNIKOV
+
+#include "PartSet_Filters.h"
+
+#include <ModuleBase_IWorkshop.h>
+
+#include <ModelAPI_Feature.h>
+#include <FeaturesPlugin_Group.h>
+
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_Shape.hxx>
+
+
+IMPLEMENT_STANDARD_HANDLE(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
+IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
+
+Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+{
+ if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
+ if (theOwner->HasSelectable()) {
+ Handle(AIS_InteractiveObject) aAisObj =
+ Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+ if (!aAisObj.IsNull()) {
+ std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+ aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
+ ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
+ if (aObj) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
+ if (aFeature) {
+ return aFeature->getKind() != FeaturesPlugin_Group::ID();
+ } else
+ return Standard_True;
+ } else
+ // This is not object controlled by the filter
+ return Standard_True;
+ }
+ }
+ }
+ return Standard_False;
+}
--- /dev/null
+// File: PartSet_Filters.h
+// Created: 08 Nov 2014
+// Author: Vitaly SMETANNIKOV
+
+#ifndef PartSet_Filters_H
+#define PartSet_Filters_H
+
+#include <ModuleBase_ViewerFilters.h>
+
+
+/**
+* A class which filters groups object in addition to documents (see issue #310)
+*/
+DEFINE_STANDARD_HANDLE(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
+class PartSet_GlobalFilter: public ModuleBase_ShapeDocumentFilter
+{
+public:
+ PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop)
+ : ModuleBase_ShapeDocumentFilter(theWorkshop) {}
+
+ Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
+
+ DEFINE_STANDARD_RTTI(PartSet_GlobalFilter)
+};
+
+#endif
\ No newline at end of file
}
}
if (myDocumentShapeFilter.IsNull())
- myDocumentShapeFilter = new ModuleBase_ShapeDocumentFilter(myWorkshop);
+ myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
}
#define PartSet_Module_H
#include "PartSet.h"
+#include <PartSet_Filters.h>
#include <ModuleBase_IModule.h>
#include <ModuleBase_Definitions.h>
-#include <ModuleBase_ViewerFilters.h>
#include <XGUI_Command.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Attribute.h>
Handle(ModuleBase_ShapeInPlaneFilter) myPlaneFilter;
/// A filter which provides selection within a current document or whole PartSet
- Handle(ModuleBase_ShapeDocumentFilter) myDocumentShapeFilter;
+ Handle(PartSet_GlobalFilter) myDocumentShapeFilter;
};
#endif