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 shapes or results
53 /// Sets the colors for the presentation compute
54 /// \param theColor an argument shapes color
55 void setShapeColor(const Quantity_Color& theColor);
57 /// Switch on using of the AIS presentation with of the shape object increased on the delta
60 DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
63 /// Redefinition of virtual function
64 Standard_EXPORT virtual void Compute(
65 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
66 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
68 /// Redefinition of virtual function
69 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
70 const Standard_Integer aMode) ;
73 /// Returns map of feature shapes to be able to fill it outside this class, e.g. in friend
74 /// \return a map of object to shape
75 QMap<ObjectPtr, QList<GeomShapePtr> >& featureShapes() { return myFeatureShapes; }
78 /// Return true if the object is visible. If the object is feature, it returns true
79 /// if all results of the feature are shown
80 /// \param theDisplayer a displayer
81 /// \param theObject an object
82 /// \return a boolean value
83 static bool isVisible(XGUI_Displayer* theDislayer, const ObjectPtr& theObject);
85 /// Fills the map by the feature object and shapes, which should be visuaziled
86 /// Gets feature attributes, collect objects to whom the attributes refer
87 /// \param theFeature a current feature
88 /// \param theWorkshop a current workshop
89 /// \param theObjectShapes an output map
90 /// \param theObjectShape an output map of objects
91 static void getFeatureShapes(const FeaturePtr& theFeature,
92 ModuleBase_IWorkshop* theWorkshop,
93 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
95 /// Fills the map by the feature object and shapes, which should be visuaziled
96 /// Gets feature attributes, collect objects to whom the attributes refer
97 /// \param theFeature a current feature
98 /// \param theWorkshop a current workshop
99 /// \param theObjectShapes an output map
100 /// \param theObjectShape an output map of objects
101 static void getResultShapes(const FeaturePtr& theFeature,
102 ModuleBase_IWorkshop* theWorkshop,
103 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
105 /// Fills the map by the feature object and shapes, which should be visuaziled
106 /// Gets the active widget, obtain the highlighted presentations if it has such and
107 /// fill map by object and shapes
108 /// \param theWorkshop a current workshop
109 /// \param theObjectShapes an output map of objects
110 static void getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
111 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
113 /// Returns true if the attribute type belong to reference attribute
114 /// \param theAttribute an attribute
115 /// \return a boolean value
116 static bool isSelectionAttribute(const AttributePtr& theAttribute);
118 /// Converts the current workshop to XGUI workshop
119 /// \param theWorkshop an interface workshop
120 /// \return a workshop instance
121 static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
124 QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes; /// visualized shapes
126 ModuleBase_IWorkshop* myWorkshop; /// current workshop
127 Quantity_Color myShapeColor; /// color of feature depended shapes
128 bool myUseAISWidth; /// flag if the width of a shape object should be used for the shape visualization
130 friend class PartSet_CustomPrs;