]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_OperationPrs.h
Salome HOME
Issue #591 - Highlight of the first argument of constraints
[modules/shaper.git] / src / PartSet / PartSet_OperationPrs.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_OperationPrs.h
4 // Created:     01 Jul 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef PartSet_OperationPrs_H
8 #define PartSet_OperationPrs_H
9
10 #include "PartSet.h"
11
12 #include <ModelAPI_Object.h>
13 #include <ModelAPI_Feature.h>
14 #include <ModelAPI_Attribute.h>
15
16 #include <ModuleBase_IWorkshop.h>
17
18 #include <GeomAPI_Shape.h>
19
20 #include <ViewerData_AISShape.hxx>
21 #include <Standard_DefineHandle.hxx>
22
23 #include <QMap>
24 #include <QList>
25
26 DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
27
28 class XGUI_Workshop;
29 class XGUI_Displayer;
30
31 /**
32 * \ingroup GUI
33 * A redefinition of standard AIS Interactive Object in order to provide colored presentation of
34 * a list of shapes. It contains a shapes where the parameter feature refers. It processes the following
35 * types of attributes: ModelAPI_AttributeSelectionList, ModelAPI_AttributeRefAttr,
36 * ModelAPI_AttributeSelection and ModelAPI_AttributeReference.
37 * The selection for this presentation is absent.
38 */
39 class PartSet_OperationPrs : public ViewerData_AISShape
40 {
41 public:
42   /// Constructor
43   Standard_EXPORT PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop);
44
45   /// Returns true if the feature contains attributes, which has references to other features
46   /// \param theFeature a feature
47   /// \return boolean result
48   bool canActivate(const FeaturePtr& theFeature);
49
50   /// Sets the operation feature. It is used in Compute method to group the feature parameter shapes
51   /// theFeature a feature
52   void setFeature(const FeaturePtr& theFeature);
53
54   /// Returns true if the presentation 
55   bool dependOn(const ObjectPtr& theObject);
56
57   // Recompute internal list of shaped dependent on the current feature
58   void updateShapes();
59
60   DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
61
62 protected:
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);
67
68   /// Redefinition of virtual function
69   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
70                                                 const Standard_Integer aMode) ;
71 private:
72   /// Return true if the object is visible. If the object is feature, it returns true
73   /// if all results of the feature are shown
74   /// \param theDisplayer a displayer
75   /// \param theObject an object
76   /// \return a boolean value
77   bool isVisible(XGUI_Displayer* theDislayer, const ObjectPtr& theObject);
78
79   /// Fills the map by the feature object and shapes, which should be visuaziled
80   /// Gets the feature attribute, collect objects to whom the attribute refers
81   /// \param theObjectShape an output map of objects
82   void getFeatureShapes(QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
83
84   /// Returns true if the attribute type belong to reference attribute
85   /// \param theAttribute an attribute
86   /// \return a boolean value
87   static bool isSelectionAttribute(const AttributePtr& theAttribute);
88
89   /// Converts the current workshop to XGUI workshop
90   /// \return a workshop instance
91   XGUI_Workshop* workshop() const;
92
93 private:
94   ModuleBase_IWorkshop* myWorkshop;
95   FeaturePtr myFeature; /// Reference to a feature object
96   QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes;
97 };
98
99
100 #endif