It removes filters.
SET(PROJECT_HEADERS
ModuleBase.h
ModuleBase_Filter.h
- ModuleBase_FilterCustom.h
- ModuleBase_FilterFace.h
ModuleBase_FilterFactory.h
- ModuleBase_FilterLinearEdge.h
- ModuleBase_FilterMulti.h
- ModuleBase_FilterNoConsructionSubShapes.h
- ModuleBase_FilterNoDegeneratedEdge.h
- ModuleBase_FilterShapeType.h
ModuleBase_FilterValidated.h
ModuleBase_Tools.h
ModuleBase_IModule.h
SET(PROJECT_SOURCES
ModuleBase_Filter.cpp
- ModuleBase_FilterCustom.cpp
- ModuleBase_FilterFace.cpp
ModuleBase_FilterFactory.cpp
- ModuleBase_FilterLinearEdge.cpp
- ModuleBase_FilterMulti.cpp
- ModuleBase_FilterNoConsructionSubShapes.cpp
- ModuleBase_FilterNoDegeneratedEdge.cpp
- ModuleBase_FilterShapeType.cpp
ModuleBase_FilterValidated.cpp
ModuleBase_Tools.cpp
ModuleBase_IModule.cpp
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterCustom.cpp
-// Created: 10 Dec 2014
-// Author: Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterCustom.h"
-
-#include <StdSelect_EdgeFilter.hxx>
-#include <StdSelect_TypeOfEdge.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-ModuleBase_FilterCustom::ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter)
-: ModuleBase_Filter()
-{
- myFilter = theFilter;
-}
-
-void ModuleBase_FilterCustom::createFilter()
-{
-}
-
-void ModuleBase_FilterCustom::setArguments(const std::list<std::string>& theArguments)
-{
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterCustom.h
-// Created: 10 Dec 2014
-// Author: Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterCustom_H
-#define ModuleBase_FilterCustom_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-/**
-* \ingroup GUI
-* This is a child of ModuleBase_Filter to be used in the factory of filters. Despite of other
-* child it does not create the internal filter itself, it get it from the constructor argument.
-* This is useful for custom filters, which are not the standard OCC filters. It is not necessary
-* to redefine the ModuleBase_Filter. The filter is realized and put here as the class parameter.
-*/
-
-class ModuleBase_FilterCustom: public ModuleBase_Filter
-{
-public:
- /**
- * Constructor
- * \param theFilter an OCC filter to be used in the parent base filter
- */
- MODULEBASE_EXPORT ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter);
-
- /**
- * Sets the arguments to the filter. Currently it is not used in this filter.
- * \param theArguments a list of arguments
- */
- MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
- /**
- * It creates an OCC filter. The realization is empty because the filter is set through the constructor
- */
- virtual void createFilter();
-
-};
-
-#endif //ModuleBase_FilterCustom
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterFace.cpp
-// Created: 10 Dec 2014
-// Author: Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterFace.h"
-
-#include <StdSelect_FaceFilter.hxx>
-#include <StdSelect_TypeOfFace.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-typedef QMap<QString, StdSelect_TypeOfFace> FaceTypes;
-static FaceTypes MyFaceTypes;
-
-StdSelect_TypeOfFace ModuleBase_FilterFace::faceType(const std::string& theType)
-{
- if (MyFaceTypes.count() == 0) {
- MyFaceTypes["plane"] = StdSelect_Plane;
- MyFaceTypes["cylinder"] = StdSelect_Cylinder;
- }
- QString aType = QString(theType.c_str()).toLower();
- if (MyFaceTypes.contains(aType))
- return MyFaceTypes[aType];
- Events_Error::send("Face type defined in XML is not implemented!");
- return StdSelect_AnyFace;
-}
-
-void ModuleBase_FilterFace::createFilter()
-{
- myFilter = new StdSelect_FaceFilter(StdSelect_AnyFace);
-}
-
-void ModuleBase_FilterFace::setArguments(const std::list<std::string>& theArguments)
-{
- if (theArguments.size()!= 1)
- return;
-
- std::string anArgument = theArguments.front();
- Handle(StdSelect_FaceFilter) aFilter = Handle(StdSelect_FaceFilter)::DownCast(getFilter());
- if (!aFilter.IsNull())
- aFilter->SetType(faceType(anArgument));
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterFace.h
-// Created: 10 Dec 2014
-// Author: Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterFace_H
-#define ModuleBase_FilterFace_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfFace.hxx>
-
-/**
-* \ingroup GUI
-* A class of a viewer filter by faces
-*/
-class ModuleBase_FilterFace: public ModuleBase_Filter
-{
-public:
- /// Convert string to StdSelect_TypeOfFace value
- /// \param theType a string value
- static MODULEBASE_EXPORT StdSelect_TypeOfFace faceType(const std::string& theType);
-
- /// Constructor
- MODULEBASE_EXPORT ModuleBase_FilterFace():
- ModuleBase_Filter() {}
-
- /**
- * Sets the arguments to the filter.
- * \param theArguments a list of arguments
- */
- MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
- /**
- * It creates an OCC face filter
- */
- virtual void createFilter();
-
-};
-
-#endif //ModuleBase_FilterFace
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterLinearEdge.cpp
-// Created: 10 Dec 2014
-// Author: Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterLinearEdge.h"
-
-#include <StdSelect_EdgeFilter.hxx>
-#include <StdSelect_TypeOfEdge.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-typedef QMap<QString, StdSelect_TypeOfEdge> EdgeTypes;
-static EdgeTypes MyEdgeTypes;
-
-StdSelect_TypeOfEdge ModuleBase_FilterLinearEdge::edgeType(const std::string& theType)
-{
- if (MyEdgeTypes.count() == 0) {
- MyEdgeTypes["line"] = StdSelect_Line;
- MyEdgeTypes["circle"] = StdSelect_Circle;
- }
- QString aType = QString(theType.c_str()).toLower();
- if (MyEdgeTypes.contains(aType))
- return MyEdgeTypes[aType];
- Events_Error::send("Edge type defined in XML is not implemented!");
- return StdSelect_AnyEdge;
-}
-
-void ModuleBase_FilterLinearEdge::createFilter()
-{
- myFilter = new StdSelect_EdgeFilter(StdSelect_AnyEdge);
-}
-
-void ModuleBase_FilterLinearEdge::setArguments(const std::list<std::string>& theArguments)
-{
- if (theArguments.size()!= 1)
- return;
-
- std::string anArgument = theArguments.front();
- Handle(StdSelect_EdgeFilter) aFilter = Handle(StdSelect_EdgeFilter)::DownCast(getFilter());
- if (!aFilter.IsNull())
- aFilter->SetType(edgeType(anArgument));
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterLinearEdge.h
-// Created: 10 Dec 2014
-// Author: Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterLinearEdge_H
-#define ModuleBase_FilterLinearEdge_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfEdge.hxx>
-
-/**
-* \ingroup GUI
-* A class of a viewer filter by linear edges
-*/
-class ModuleBase_FilterLinearEdge: public ModuleBase_Filter
-{
-public:
- /// Convert string to StdSelect_TypeOfFace value
- /// \param theType a string value
- static MODULEBASE_EXPORT StdSelect_TypeOfEdge edgeType(const std::string& theType);
-
- /// Constructor
- MODULEBASE_EXPORT ModuleBase_FilterLinearEdge():
- ModuleBase_Filter() {}
-
- /**
- * Sets the arguments to the filter.
- * \param theArguments a list of arguments
- */
- MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
- /**
- * It creates an OCC edge filter
- */
- virtual void createFilter();
-
-};
-
-#endif //ModuleBase_FilterLinearEdge
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterMulti.cpp
-// Created: 12 Jan 2015
-// Author: Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterMulti.h"
-
-#include "ModuleBase_FilterLinearEdge.h"
-#include "ModuleBase_FilterShapeType.h"
-
-#include <SelectMgr_OrFilter.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-ModuleBase_Filter* ModuleBase_FilterMulti::findFilter(const std::string& theType)
-{
- ModuleBase_Filter* aFilter = 0;
-
- if (theType == "line") {
- aFilter = new ModuleBase_FilterLinearEdge();
- std::list<std::string> anArguments;
- anArguments.push_back(theType);
- aFilter->setArguments(anArguments);
- }
- if (theType == "vertex") {
- aFilter = new ModuleBase_FilterShapeType();
- std::list<std::string> anArguments;
- anArguments.push_back(theType);
- aFilter->setArguments(anArguments);
- }
-
- return aFilter;
-}
-
-void ModuleBase_FilterMulti::createFilter()
-{
- myFilter = new SelectMgr_OrFilter();
-
- // set filter arguments
- Handle(SelectMgr_OrFilter) anOrFilter = Handle(SelectMgr_OrFilter)::DownCast(myFilter);
- if (anOrFilter.IsNull())
- return;
-
- std::list<std::string>::const_iterator anIt = myArguments.begin(),
- aLast = myArguments.end();
- for (; anIt != aLast; ++anIt) {
- std::string aType = *anIt;
- ModuleBase_Filter* aFilter = findFilter(aType);
- if (aFilter) {
- anOrFilter->Add(aFilter->getFilter());
- }
- }
-}
-
-void ModuleBase_FilterMulti::setArguments(const std::list<std::string>& theArguments)
-{
- myArguments.clear();
- myArguments = theArguments;
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterMulti.h
-// Created: 12 Jan 2015
-// Author: Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterMulti_H
-#define ModuleBase_FilterMulti_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfFace.hxx>
-
-/**
-* \ingroup GUI
-* An implementation of filter which support using of several filters according to OR statement
-*/
-class ModuleBase_FilterMulti: public ModuleBase_Filter
-{
- /**
- * Creates a new filter according to the given type
- * It is only for internal use.
- * This class creates the sub-filters now. It is possible to use the filter factory for this.
- * \param theType a type of the created filter
- */
- ModuleBase_Filter* findFilter(const std::string& theType);
-
-public:
- MODULEBASE_EXPORT ModuleBase_FilterMulti():
- ModuleBase_Filter() {}
-
- /**
- * Sets the arguments to the filter.
- * \param theArguments a list of arguments
- */
- MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
- /**
- * It creates an OCC face filter
- */
- virtual void createFilter();
-
-protected:
- /// the filter arguments
- std::list<std::string> myArguments;
-};
-
-#endif //ModuleBase_FilterMulti
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_ViewerFilters.cpp
-// Created: 07 Okt 2014
-// Author: Vitaly SMETANNIKOV
-
-
-#include "ModuleBase_FilterNoConsructionSubShapes.h"
-#include "ModuleBase_IWorkshop.h"
-
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_ResultConstruction.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Shape.hxx>
-
-#include <StdSelect_BRepOwner.hxx>
-
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <Geom_Curve.hxx>
-
-#include <ModelAPI_CompositeFeature.h>
-#include <GeomAPI_ICustomPrs.h>
-
-
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
-
-Standard_Boolean ModuleBase_FilterNoConsructionSubShapes::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
- // global selection should be ignored, the filter processes only selected sub-shapes
- Handle(StdSelect_BRepOwner) aShapeOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
- if (!aShapeOwner.IsNull()) {
- if (!aShapeOwner->ComesFromDecomposition())
- return Standard_True;
- }
-
- 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);
-
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
- if (aConstr != NULL) {
- // it provides selection only on compositie features, construction without composite
- // feature is not selectable
- FeaturePtr aFeature = ModelAPI_Feature::feature(aConstr);
- CompositeFeaturePtr aComposite =
- std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
- return aComposite && aComposite->numberOfSubs() > 0;
- }
- else
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_ViewerFilters.h
-// Created: 07 Okt 2014
-// Author: Vitaly SMETANNIKOV
-
-
-#ifndef ModuleBase_FilterNoConsructionSubShapes_H
-#define ModuleBase_FilterNoConsructionSubShapes_H
-
-#include <QStringList>
-
-#include <SelectMgr_Filter.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-
-class ModuleBase_IWorkshop;
-
-/**
-* \ingroup GUI
-* \class ModuleBase_FilterNoConsructionSubShapes
-* A filter which provides filtering of selection in 3d viewer.
-* Installing of this filter lets to select objects which belong to
-* currently active document or to global document
-*/
-DEFINE_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
-class ModuleBase_FilterNoConsructionSubShapes: public SelectMgr_Filter
-{
-public:
- /// Constructor
- /// \param theWorkshop instance of workshop interface
- Standard_EXPORT ModuleBase_FilterNoConsructionSubShapes(ModuleBase_IWorkshop* theWorkshop):
- SelectMgr_Filter(), myWorkshop(theWorkshop) {}
-
- /**
- * Returns true if the owner is computed from decomposition(it is global selection, not the sub-shapes)
- * of if the selected result is a construction and the result feature is composite and has sub-elements.
- * \param theOwner the result of selection
- * \return whether the owner is selectable in the viewer
- */
- Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
- DEFINE_STANDARD_RTTI(ModuleBase_FilterNoConsructionSubShapes)
-
-protected:
- /// Instance of workshop interface
- ModuleBase_IWorkshop* myWorkshop;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_ViewerFilters.cpp
-// Created: 10 Feb 2015
-// Author: Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterNoDegeneratedEdge.h"
-
-#include <StdSelect_BRepOwner.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <BRep_Tool.hxx>
-
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterNoDegeneratedEdge, StdSelect_EdgeFilter);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterNoDegeneratedEdge, StdSelect_EdgeFilter);
-
-ModuleBase_FilterNoDegeneratedEdge::ModuleBase_FilterNoDegeneratedEdge()
-: StdSelect_EdgeFilter(StdSelect_AnyEdge)
-{
-}
-
-Standard_Boolean ModuleBase_FilterNoDegeneratedEdge::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
- bool isEdge = StdSelect_EdgeFilter::IsOk(theOwner);
- if (isEdge) {
- Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
- if (!anOwner.IsNull() && anOwner->HasShape()) {
- const TopoDS_Shape& aShape = anOwner->Shape();
- if (BRep_Tool::Degenerated(TopoDS::Edge(aShape)))
- return Standard_False;
- }
- }
- return isEdge;
-}
-
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_ViewerFilters.h
-// Created: 10 Feb 2015
-// Author: Natalia ERMOLAEVA
-
-
-#ifndef ModuleBase_FilterNoDegeneratedEdge_H
-#define ModuleBase_FilterNoDegeneratedEdge_H
-
-#include <QStringList>
-
-#include <StdSelect_EdgeFilter.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-
-/**
-* \ingroup GUI
-* \class ModuleBase_FilterNoDegeneratedEdge
-* An edge filter, which additionally filters degenerative edges.
-*/
-DEFINE_STANDARD_HANDLE(ModuleBase_FilterNoDegeneratedEdge, StdSelect_EdgeFilter);
-class ModuleBase_FilterNoDegeneratedEdge: public StdSelect_EdgeFilter
-{
-public:
- /// Constructor
- Standard_EXPORT ModuleBase_FilterNoDegeneratedEdge();
-
- /**
- * Returns true if the owner is computed from decomposition(it is global selection, not the sub-shapes)
- * of if the selected result is a construction and the result feature is composite and has sub-elements.
- * \param theOwner the result of selection
- * \return whether the owner is selectable in the viewer
- */
- Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
- DEFINE_STANDARD_RTTI(ModuleBase_FilterNoDegeneratedEdge)
-
-protected:
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterShapeType.cpp
-// Created: 12 Jan 2015
-// Author: Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterShapeType.h"
-
-#include <StdSelect_ShapeTypeFilter.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-typedef QMap<QString, TopAbs_ShapeEnum> FaceTypes;
-static FaceTypes MyShapeTypes;
-
-TopAbs_ShapeEnum ModuleBase_FilterShapeType::shapeType(const std::string& theType)
-{
- if (MyShapeTypes.count() == 0) {
- MyShapeTypes["vertex"] = TopAbs_VERTEX;
- }
- QString aType = QString(theType.c_str()).toLower();
- if (MyShapeTypes.contains(aType))
- return MyShapeTypes[aType];
- Events_Error::send("Shape type defined in XML is not implemented!");
- return TopAbs_SHAPE;
-}
-
-ModuleBase_FilterShapeType::ModuleBase_FilterShapeType()
-: ModuleBase_Filter(), myShapeType(TopAbs_SHAPE)
-{
-}
-
-void ModuleBase_FilterShapeType::createFilter()
-{
- myFilter = new StdSelect_ShapeTypeFilter(myShapeType);
-}
-
-void ModuleBase_FilterShapeType::setArguments(const std::list<std::string>& theArguments)
-{
- if (theArguments.size()!= 1)
- return;
- myShapeType = shapeType(theArguments.front());
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModuleBase_FilterShapeType.h
-// Created: 12 Jan 2015
-// Author: Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterShapeType_H
-#define ModuleBase_FilterShapeType_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfFace.hxx>
-
-/**
-* \ingroup GUI
-* A class of a viewer filter by shape type
-*/
-class ModuleBase_FilterShapeType: public ModuleBase_Filter
-{
-public:
- /// Constructor
- /// \param theType type of shape
- static MODULEBASE_EXPORT TopAbs_ShapeEnum shapeType(const std::string& theType);
-
- MODULEBASE_EXPORT ModuleBase_FilterShapeType();
-
- /**
- * Sets the arguments to the filter.
- * \param theArguments a list of arguments
- */
- MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
- /**
- * It creates an OCC face filter
- */
- virtual void createFilter();
-
-private:
- /// the shape type of the filter
- TopAbs_ShapeEnum myShapeType;
-};
-
-#endif //ModuleBase_FilterShapeType
#include <ModuleBase_IModule.h>
#include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ISelection.h>
#include <ModuleBase_Operation.h>
#include <ModuleBase_WidgetValidated.h>
+#include <ModuleBase_ViewerPrs.h>
IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterValidated, SelectMgr_Filter);
IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter);
ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
(anActiveWidget);
- return !aWidgetValidated || aWidgetValidated->isValid(theOwner);
+ ModuleBase_ViewerPrs aPrs;
+ myWorkshop->selection()->fillPresentation(aPrs, theOwner);
+
+ return !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
}
}
return Standard_False;
}
-
-
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-
-
-//TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340)
-Standard_Boolean ModuleBase_ObjectTypesFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
- Standard_Boolean isOk = ModuleBase_ShapeDocumentFilter::IsOk(theOwner);
- if (isOk && 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);
-
- foreach (QString aType, myTypes) {
- if (aType.toLower() == "construction") {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
- return (aConstr != NULL);
- } // ToDo: Process other types of objects
- }
- }
- }
- return Standard_False;
-}
gp_Pln myPlane;
};
-
-/**
-* \class ModuleBase_ObjectTypesFilter
-* \ingroup GUI
-* A filter which provides filtering of selection in 3d viewer.
-* Installing of this filter lets to select only object of requested type
-* Accepts following objects types:
-* - "construction" - to select ModelAPI_ResultConstruction objects
-*/
-DEFINE_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-class ModuleBase_ObjectTypesFilter: public ModuleBase_ShapeDocumentFilter
-{
-public:
- /// Constructor
- /// \param theWorkshop instance of workshop interface
- /// \param theTypes list of object types
- Standard_EXPORT ModuleBase_ObjectTypesFilter(ModuleBase_IWorkshop* theWorkshop, const QStringList& theTypes):
- ModuleBase_ShapeDocumentFilter(theWorkshop), myTypes(theTypes) {}
-
- /// Returns True if the given owner is acceptable for selection
- /// \param theOwner the selected owner
- Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
- DEFINE_STANDARD_RTTI(ModuleBase_ObjectTypesFilter)
-private:
- /// List of object types
- QStringList myTypes;
-};
-
-#endif
\ No newline at end of file
+#endif
/// Sets the object.
/// \param theResult an object instance
- void setFeature(ObjectPtr theResult)
+ void setObject(ObjectPtr theResult)
{
myResult = theResult;
}
return myInteractive;
}
+ /// Returns true if all presentation fields are empty
+ /// \return boolean value
+ bool isEmpty() const
+ {
+ return myShape.IsNull() &&
+ myOwner.IsNull() && !myResult.get();
+ }
+
/// Returns True if the current object is equal to the given one
/// \param thePrs an object to compare
bool operator==(const ModuleBase_ViewerPrs& thePrs)
}
//********************************************************************
-bool ModuleBase_WidgetMultiSelector::setSelection(const Handle_SelectMgr_EntityOwner& theOwner)
+bool ModuleBase_WidgetMultiSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
{
- ModuleBase_ViewerPrs aPrs;
- ModuleBase_ISelection* aSelection = myWorkshop->selection();
- aSelection->fillPresentation(aPrs, theOwner);
-
- const TopoDS_Shape& aTDSShape = aPrs.shape();
+ const TopoDS_Shape& aTDSShape = thePrs.shape();
if (aTDSShape.IsNull())
return false;
GeomShapePtr aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aTDSShape));
- ObjectPtr anObject = aSelection->getSelectableObject(theOwner);
+ ObjectPtr anObject = myWorkshop->selection()->getSelectableObject(thePrs.owner());
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
if (myFeature) {
// We can not select a result of our feature
aSelectionListAttr->clear();
if (aSelected.size() > 0) {
foreach (ModuleBase_ViewerPrs aPrs, aSelected) {
- Handle(SelectMgr_EntityOwner) anOwner = aPrs.owner();
- if (isValid(anOwner)) {
- setSelection(anOwner);
+ if (isValidSelection(aPrs)) {
+ setSelectionCustom(aPrs);
}
}
}
/// Fills the attribute with the value of the selected owner
/// \param theOwner a selected owner
- virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner);
+ virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
public slots:
/// Slot is called on selection type changed
//QObjectPtrList aObjects = myWorkshop->selection()->selectedPresentations();
QList<ModuleBase_ViewerPrs> aSelected = myWorkshop->selection()->getSelected();
if (aSelected.size() > 0) {
- Handle(SelectMgr_EntityOwner) anOwner = aSelected.first().owner();
- if (isValid(anOwner)) {
- setSelection(anOwner);
+ if (isValidSelection(aSelected.first())) {
+ setSelectionCustom(aSelected.first());
// the updateObject method should be called to flush the updated sigal. The workshop listens it,
// calls validators for the feature and, as a result, updates the Apply button state.
updateObject(myFeature);
}
//********************************************************************
-bool ModuleBase_WidgetShapeSelector::setSelection(const Handle_SelectMgr_EntityOwner& theOwner)
+bool ModuleBase_WidgetShapeSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
{
bool isDone = false;
- ModuleBase_ViewerPrs aPrs;
- myWorkshop->selection()->fillPresentation(aPrs, theOwner);
// It should be checked by corresponded validator
- ObjectPtr aObject = aPrs.object();
+ ObjectPtr aObject = thePrs.object();
ObjectPtr aCurrentObject = GeomValidators_Tools::getObject(myFeature->attribute(attributeID()));
/*
if ((!aCurrentObject) && (!aObject))
return false;
// Get sub-shapes from local selection
- if (!aPrs.shape().IsNull()) {
+ if (!thePrs.shape().IsNull()) {
aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
- aShape->setImpl(new TopoDS_Shape(aPrs.shape()));
+ aShape->setImpl(new TopoDS_Shape(thePrs.shape()));
}
// Check that the selection corresponds to selection type
if (!acceptSubShape(aShape))
/// Fills the attribute with the value of the selected owner
/// \param theOwner a selected owner
- virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner);
+ virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
/// The methiod called when widget is deactivated
virtual void deactivate();
{
bool isDone = false;
- Handle(SelectMgr_EntityOwner) anOwner = theValue.owner();
- if (isValid(anOwner)) {
- isDone = setSelection(anOwner);
+ if (isValidSelection(theValue)) {
+ isDone = setSelectionCustom(theValue);
updateObject(myFeature);
emit valuesChanged();
}
}
//********************************************************************
-bool ModuleBase_WidgetValidated::isValid(const Handle_SelectMgr_EntityOwner& theOwner)
+bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& theValue)
{
DataPtr aData = myFeature->data();
AttributePtr anAttribute = myFeature->attribute(attributeID());
storeAttributeValue();
// saves the owner value to the widget attribute
- bool aValid = setSelection(theOwner);
+ bool aValid = setSelectionCustom(theValue);
if (aValid)
// checks the attribute validity
/// Checks all widget validator if the owner is valid
/// \param theOwner a selected owner in the view
/// \return a boolean value
- bool isValid(const Handle_SelectMgr_EntityOwner& theOwner);
+ bool isValidSelection(const ModuleBase_ViewerPrs& theValue);
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// Fills the attribute with the value of the selected owner
/// \param theOwner a selected owner
- virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner) = 0;
+ virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs) = 0;
virtual void removePresentations() {};
PartSet_WidgetPoint2dDistance.h
PartSet_WidgetShapeSelector.h
PartSet_Filters.h
- PartSet_FilterSketchEntity.h
PartSet_SketcherMgr.h
PartSet_MenuMgr.h
)
PartSet_WidgetPoint2dDistance.cpp
PartSet_WidgetShapeSelector.cpp
PartSet_Filters.cpp
- PartSet_FilterSketchEntity.cpp
PartSet_SketcherMgr.cpp
PartSet_MenuMgr.cpp
)
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PartSet_FilterSketchEntity.cpp
-// Created: 13 Mar 2015
-// Author: Natalia ERMOLAEVA
-
-#include "PartSet_FilterSketchEntity.h"
-
-#include <ModuleBase_IWorkshop.h>
-
-#include <ModelAPI_Feature.h>
-#include <FeaturesPlugin_Group.h>
-
-#include <SketchPlugin_Sketch.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Shape.hxx>
-
-
-IMPLEMENT_STANDARD_HANDLE(PartSet_FilterSketchEntity, ModuleBase_ShapeDocumentFilter);
-IMPLEMENT_STANDARD_RTTIEXT(PartSet_FilterSketchEntity, ModuleBase_ShapeDocumentFilter);
-
-Standard_Boolean PartSet_FilterSketchEntity::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->getKind() == SketchPlugin_Sketch::ID())
- return Standard_True;
- }
- }
- }
- }
- return Standard_False;
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PartSet_FilterSketchEntity.h
-// Created: 13 Mar 2015
-// Author: Natalia ERMOLAEVA
-
-#ifndef PartSet_FilterSketchEntity_H
-#define PartSet_FilterSketchEntity_H
-
-#include <ModuleBase_ViewerFilters.h>
-
-/**
-* \class PartSet_FilterSketchEntity
-* \ingroup Modules
-* A class which filters groups object in addition to documents (see issue #310)
-*/
-DEFINE_STANDARD_HANDLE(PartSet_FilterSketchEntity, ModuleBase_ShapeDocumentFilter);
-class PartSet_FilterSketchEntity: public ModuleBase_ShapeDocumentFilter
-{
-public:
- /// Constructor
- /// \param theWorkshop a pointer to workshop
- PartSet_FilterSketchEntity(ModuleBase_IWorkshop* theWorkshop)
- : ModuleBase_ShapeDocumentFilter(theWorkshop) {}
-
- /// Returns True if selected presentation can be selected
- /// \param theOwner an owner of the persentation
- Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
- DEFINE_STANDARD_RTTI(PartSet_FilterSketchEntity)
-};
-
-#endif
\ No newline at end of file
#include <ModuleBase_IPropertyPanel.h>
#include <ModuleBase_WidgetEditor.h>
#include <ModuleBase_FilterFactory.h>
-#include <ModuleBase_FilterLinearEdge.h>
-#include <ModuleBase_FilterFace.h>
-#include <ModuleBase_FilterMulti.h>
-#include <ModuleBase_FilterCustom.h>
-#include <ModuleBase_FilterNoConsructionSubShapes.h>
#include <GeomValidators_Edge.h>
#include <GeomValidators_EdgeOrVertex.h>
#include <GeomValidators_Face.h>
#include <GeomValidators_ConstructionComposite.h>
-#include <PartSet_FilterSketchEntity.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_Events.h>
//Registering of selection filters
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
-
- //aFactory->registerFilter("EdgeFilter", new ModuleBase_FilterLinearEdge);
- //aFactory->registerFilter("FaceFilter", new ModuleBase_FilterFace);
- //aFactory->registerFilter("MultiFilter", new ModuleBase_FilterMulti);
- //Handle(SelectMgr_Filter) aSelectFilter = new ModuleBase_FilterNoConsructionSubShapes(workshop());
- //aFactory->registerFilter("NoConstructionSubShapesFilter",
- // new ModuleBase_FilterCustom(aSelectFilter));
- //Handle(SelectMgr_Filter) aSelectFilter = new PartSet_FilterSketchEntity(workshop());
- //aFactory->registerFilter("SketchEntityFilter", new ModuleBase_FilterCustom(aSelectFilter));
}
void PartSet_Module::registerProperties()
#include <QMouseEvent>
#include <QApplication>
+//#define DEBUG_DO_NOT_BY_ENTER
/// Returns list of unique objects by sum of objects from List1 and List2
/*QList<ModuleBase_ViewerPrs> getSumList(const QList<ModuleBase_ViewerPrs>& theList1,
myIsMouseOverWindow = true;
myIsPropertyPanelValueChanged = false;
- if (!isNestedCreateOperation(getCurrentOperation()))
- return;
+ #ifdef DEBUG_DO_NOT_BY_ENTER
+ return;
+ #endif
+ //if (!isNestedCreateOperation(getCurrentOperation()))
+ // return;
}
void PartSet_SketcherMgr::onLeaveViewPort()
myIsMouseOverWindow = false;
myIsPropertyPanelValueChanged = false;
+ #ifdef DEBUG_DO_NOT_BY_ENTER
+ return;
+ #endif
+
if (!isNestedCreateOperation(getCurrentOperation()))
return;
// the method should be performed if the popup menu is called,
aCanDisplay = false;
}
else { // there are no an active sketch
- // 2. sketch sub-features should not visualized if the sketch operatio is not active
+ // 2. sketch sub-features should not visualized if the sketch operation is not active
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get() != NULL) {
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
// a. the property panel values modification
// b. the popup menu activated
// c. widget editor control
+ #ifndef DEBUG_DO_NOT_BY_ENTER
if (aCanDisplay && isNestedCreateOperation(getCurrentOperation())) {
ModuleBase_Operation* aOperation = getCurrentOperation();
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow;
}
}
+ #endif
return aCanDisplay;
}
void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation,
const bool isToDisplay)
{
+ #ifdef DEBUG_DO_NOT_BY_ENTER
+ return;
+ #endif
+
if (!theOperation || theOperation->isEditOperation())
return;
#include <ModuleBase_Tools.h>
#include <ModuleBase_IModule.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_Tools.h>
+
#include <GeomAlgoAPI_FaceBuilder.h>
#include <GeomDataAPI_Point.h>
#include <GeomDataAPI_Dir.h>
return aResult;
}
-void PartSet_WidgetSketchLabel::onPlaneSelected()
+void PartSet_WidgetSketchLabel::onSelectionChanged()
{
-
+ ModuleBase_ViewerPrs aPrs;
+ // 1. find selected presentation either in the viewer or in OB
XGUI_Selection* aSelection = myWorkshop->selector()->selection();
QList<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+ // the selection in OCC viewer - the selection of a face in the viewer
+ // it can be th main plane's face of a face on a visualized body
if (!aSelected.empty()) {
- ModuleBase_ViewerPrs aPrs = aSelected.first();
- Handle(SelectMgr_EntityOwner) anOwner = aSelected.first().owner();
- if (isValid(anOwner)) {
- setSelection(anOwner);
-
- TopoDS_Shape aShape = aPrs.shape();
- if (!aShape.IsNull()) {
- erasePreviewPlanes();
- DataPtr aData = feature()->data();
- AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
- (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
- if (aSelAttr) {
- GeomShapePtr aShapePtr = aSelAttr->value();
- if (aShapePtr.get() == NULL || aShapePtr->isNull()) {
- std::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
- aGShape->setImpl(new TopoDS_Shape(aShape));
- // get plane parameters
- std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
- std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
-
- myWorkshop->viewer()->setViewProjection(aDir->x(), aDir->y(), aDir->z());
- }
- }
+ aPrs = aSelected.first();
+ }
+ else {
+ // the selection in Object Browser: the plane object can be used as sketch plane
+ QObjectPtrList anObjects = aSelection->selectedObjects();
+ if (!anObjects.empty()) {
+ aPrs.setObject(anObjects.first());
+ }
+ }
+ if (aPrs.isEmpty())
+ return;
- // Clear text in the label
- myLabel->setText("");
- myLabel->setToolTip("");
- disconnect(myWorkshop->selector(), SIGNAL(selectionChanged()),
- this, SLOT(onPlaneSelected()));
- activateFilters(myWorkshop->module()->workshop(), false);
-
- // Clear selection mode and define sketching mode
- //XGUI_Displayer* aDisp = myWorkshop->displayer();
- //aDisp->closeLocalContexts();
- emit planeSelected(plane());
- //setSketchingMode();
-
- // Update sketcher actions
- XGUI_ActionsMgr* anActMgr = myWorkshop->actionsMgr();
- anActMgr->update();
- myWorkshop->viewer()->update();
+ if (isValidSelection(aPrs)) {
+ // 2. set the selection to sketch
+ setSelectionCustom(aPrs);
+ // 3. hide main planes if they have been displayed
+ erasePreviewPlanes();
+ // 4. if the planes were displayed, change the view projection
+ TopoDS_Shape aShape = aPrs.shape();
+ if (!aShape.IsNull()) {
+ DataPtr aData = feature()->data();
+ AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+ (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
+ if (aSelAttr) {
+ GeomShapePtr aShapePtr = aSelAttr->value();
+ if (aShapePtr.get() == NULL || aShapePtr->isNull()) {
+ //TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
+ std::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
+ aGShape->setImpl(new TopoDS_Shape(aShape));
+ // get plane parameters
+ std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
+ std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+
+ myWorkshop->viewer()->setViewProjection(aDir->x(), aDir->y(), aDir->z());
+ }
}
}
+ // 5. Clear text in the label
+ myLabel->setText("");
+ myLabel->setToolTip("");
+ disconnect(myWorkshop->selector(), SIGNAL(selectionChanged()),
+ this, SLOT(onSelectionChanged()));
+ // 6. deactivate face selection filter
+ activateFilters(myWorkshop->module()->workshop(), false);
+
+ // 7. Clear selection mode and define sketching mode
+ //XGUI_Displayer* aDisp = myWorkshop->displayer();
+ //aDisp->closeLocalContexts();
+ emit planeSelected(plane());
+ //setSketchingMode();
+
+ // 8. Update sketcher actions
+ XGUI_ActionsMgr* anActMgr = myWorkshop->actionsMgr();
+ anActMgr->update();
+ myWorkshop->viewer()->update();
}
}
}
}
-bool PartSet_WidgetSketchLabel::setSelection(const Handle_SelectMgr_EntityOwner& theOwner)
+bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
{
bool isOwnerSet = false;
- ModuleBase_ViewerPrs aPrs;
- myWorkshop->selector()->selection()->fillPresentation(aPrs, theOwner);
-
- const TopoDS_Shape& aShape = aPrs.shape();
+ const TopoDS_Shape& aShape = thePrs.shape();
std::shared_ptr<GeomAPI_Dir> aDir;
- if (aPrs.object() && (feature() != aPrs.object())) {
+ if (thePrs.object() && (feature() != thePrs.object())) {
DataPtr aData = feature()->data();
AttributeSelectionPtr aSelAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
(aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
if (aSelAttr) {
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs.object());
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
if (aRes) {
GeomShapePtr aShapePtr(new GeomAPI_Shape());
- aShapePtr->setImpl(new TopoDS_Shape(aShape));
+ if (aShape.IsNull()) {
+ aShapePtr = ModelAPI_Tools::shape(aRes);
+ }
+ else {
+ aShapePtr->setImpl(new TopoDS_Shape(aShape));
+ }
aSelAttr->setValue(aRes, aShapePtr);
isOwnerSet = true;
}
void PartSet_WidgetSketchLabel::activateCustom()
{
std::shared_ptr<GeomAPI_Pln> aPlane = plane();
- if (aPlane) {
+ bool aBodyIsVisualized = false;
+ XGUI_Displayer* aDisp = myWorkshop->displayer();
+ QObjectPtrList aDisplayed = aDisp->displayedObjects();
+ foreach (ObjectPtr anObj, aDisplayed) {
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
+ if (aResult.get() != NULL) {
+ aBodyIsVisualized = aResult->groupName() == ModelAPI_ResultBody::group();
+ if (aBodyIsVisualized)
+ break;
+ }
+ }
+
+ if (aPlane || aBodyIsVisualized) {
//setSketchingMode();
// In order to avoid Opening/Closing of context too often
// it can be useful for a delay on the property panel filling
// it is possible that it is not necessary anymore, but it requires a check
//mySelectionTimer->start(20);
+ //setSketchingMode();
} else {
// We have to select a plane before any operation
showPreviewPlanes();
+ }
+ QIntList aModes;
+ aModes << TopAbs_FACE;
+ aDisp->activateObjects(aModes);
- XGUI_Displayer* aDisp = myWorkshop->displayer();
- //aDisp->openLocalContext();
- //aDisp->activateObjects(QIntList());
- QIntList aModes;
- aModes << TopAbs_FACE;
- aDisp->activateObjects(aModes);
-
- myLabel->setText(myText);
- myLabel->setToolTip(myTooltip);
+ myLabel->setText(myText);
+ myLabel->setToolTip(myTooltip);
- connect(myWorkshop->selector(), SIGNAL(selectionChanged()), this, SLOT(onPlaneSelected()));
- activateFilters(myWorkshop->module()->workshop(), true);
+ connect(myWorkshop->selector(), SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+ activateFilters(myWorkshop->module()->workshop(), true);
- aDisp->updateViewer();
- }
+ aDisp->updateViewer();
}
void PartSet_WidgetSketchLabel::deactivate()
/// Fills the attribute with the value of the selected owner
/// \param theOwner a selected owner
- virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner);
+ virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
/// Saves the internal parameters to the given feature
/// \return True in success
virtual void activateCustom();
private slots:
- /// Slot on plane selection
- void onPlaneSelected();
+ /// Slot on change selection
+ void onSelectionChanged();
/// Set sketch specific mode of selection
//void setSketchingMode();
const TopoDS_Shape& aShape = aShapePrs->Shape();
std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
-
isEqualShapes = aShapePtr->isEqual(anAISShapePtr);
}
}
// Customization of presentation
bool isCustomized = customizeObject(theObject);
#ifdef DEBUG_FEATURE_REDISPLAY
- qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
- arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
+ //qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
+ // arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
#endif
if (!isEqualShapes || isCustomized) {
aContext->Redisplay(aAISIO, false);
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
ObjectPtr aFeature = aDisplayer->getObject(anIO);
- thePrs.setFeature(aFeature);
+ thePrs.setObject(aFeature);
}
QList<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted() const
ObjectPtr aResult = aDisplayer->getObject(anIO);
// we should not check the appearance of this feature because there can be some selected shapes
// for one feature
- aPrs.setFeature(aResult);
+ aPrs.setObject(aResult);
if (aContext->HasOpenedContext()) {
TopoDS_Shape aShape = aContext->DetectedShape();
if (!aShape.IsNull())
#include <dlfcn.h>
#endif
-//#define DEBUG_FEATURE_CREATED
-//#define DEBUG_FEATURE_REDISPLAY
+#define DEBUG_FEATURE_CREATED
+#define DEBUG_FEATURE_REDISPLAY
QMap<QString, QString> XGUI_Workshop::myIcons;
ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
if (aOperation && aOperation->hasObject(aObj)) {
ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
+ #ifdef DEBUG_FEATURE_REDISPLAY
+ QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
+ qDebug(QString(" display object = %1").arg(anObjInfo).toStdString().c_str());
+ #endif
if (displayObject(aObj)) {
// Deactivate object of current operation from selection
if (myDisplayer->isActive(aObj))