1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_OperationPrs.h
4 // Created: 01 Jul 2015
5 // Author: Natalia ERMOLAEVA
7 #ifndef PartSet_OperationPrs_H
8 #define PartSet_OperationPrs_H
12 #include <ModelAPI_Object.h>
13 #include <ModelAPI_Feature.h>
14 #include <ModelAPI_Result.h>
15 #include <ModelAPI_Attribute.h>
17 #include <ModuleBase_IWorkshop.h>
19 #include <GeomAPI_Shape.h>
21 #include <ViewerData_AISShape.hxx>
22 #include <Standard_DefineHandle.hxx>
24 #include <Quantity_Color.hxx>
31 DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
38 * A redefinition of standard AIS Interactive Object in order to provide colored presentation of
39 * a list of shapes. It contains a shapes where the parameter feature refers. It processes the following
40 * types of attributes: ModelAPI_AttributeSelectionList, ModelAPI_AttributeRefAttr,
41 * ModelAPI_AttributeSelection and ModelAPI_AttributeReference.
42 * The selection for this presentation is absent.
44 class PartSet_OperationPrs : public ViewerData_AISShape
48 Standard_EXPORT PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop);
50 /// Returns true if the feature contains attributes, which has references to other features
51 /// \param theFeature a feature
52 /// \return boolean result
53 bool canActivate(const FeaturePtr& theFeature);
55 /// Sets the operation feature. It is used in Compute method to group the feature parameter shapes
56 /// theFeature a feature
57 void setFeature(const FeaturePtr& theFeature);
59 /// Returns true if the presentation
60 //bool dependOn(const ObjectPtr& theObject);
62 // Recompute internal list of shaped dependent on the current feature
65 DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
68 /// Redefinition of virtual function
69 Standard_EXPORT virtual void Compute(
70 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
71 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
73 /// Redefinition of virtual function
74 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
75 const Standard_Integer aMode) ;
77 /// Return true if the object is visible. If the object is feature, it returns true
78 /// if all results of the feature are shown
79 /// \param theDisplayer a displayer
80 /// \param theObject an object
81 /// \return a boolean value
82 bool isVisible(XGUI_Displayer* theDislayer, const ObjectPtr& theObject);
84 /// Fills the map by the feature object and shapes, which should be visuaziled
85 /// Gets the feature attribute, collect objects to whom the attribute refers
86 /// \param theObjectShape an output map of objects
87 void getFeatureShapes(QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
89 /// Returns true if the attribute type belong to reference attribute
90 /// \param theAttribute an attribute
91 /// \return a boolean value
92 static bool isSelectionAttribute(const AttributePtr& theAttribute);
94 /// Converts the current workshop to XGUI workshop
95 /// \return a workshop instance
96 XGUI_Workshop* workshop() const;
99 ModuleBase_IWorkshop* myWorkshop;
100 FeaturePtr myFeature; /// Reference to a feature object
101 QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes; /// visualized shapes
102 std::list<ResultPtr> myFeatureResults; /// visualized feature results
104 Quantity_Color myShapeColor; /// color of feature depended shapes
105 Quantity_Color myResultColor; /// color of feature result