SHAPER 9.16.0
PartSet_OperationPrs.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef PartSet_OperationPrs_H
21#define PartSet_OperationPrs_H
22
23#include "PartSet.h"
24
25#include <ModelAPI_Object.h>
26#include <ModelAPI_Feature.h>
27#include <ModelAPI_Result.h>
28#include <ModelAPI_Attribute.h>
29
30#include <ModuleBase_IWorkshop.h>
31
32#include <GeomAPI_Shape.h>
33
34#include <ViewerData_AISShape.hxx>
35#include <Standard_DefineHandle.hxx>
36
37#include <Quantity_Color.hxx>
38#include <NCollection_List.hxx>
39#include <NCollection_DataMap.hxx>
40#include <TopoDS_Shape.hxx>
41#include <AIS_InteractiveObject.hxx>
42
43#include <QMap>
44#include <QList>
45
46#include <list>
47
48DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
49
50class XGUI_Displayer;
51class SelectMgr_Selection;
52
62{
63public:
65 Standard_EXPORT PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop);
66
68 bool hasShapes();
69
72 void setShapeColor(const Quantity_Color& theColor);
73
75 void useAISWidth();
76
77 DEFINE_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape)
78
79protected:
81 Standard_EXPORT virtual void Compute(
82 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
83 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
84
86 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
87 const Standard_Integer aMode) ;
88
89protected:
92 NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& shapesMap();
93
94private:
101 static void getFeatureShapes(const FeaturePtr& theFeature,
102 ModuleBase_IWorkshop* theWorkshop,
103 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
104
111 static void getResultShapes(const FeaturePtr& theFeature,
112 ModuleBase_IWorkshop* theWorkshop,
113 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes,
114 const bool theListShouldBeCleared = true);
115
121 static void getPresentationShapes(const FeaturePtr& theFeature,
122 ModuleBase_IWorkshop* theWorkshop,
123 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes,
124 const bool theListShouldBeCleared = true);
125
131 static void getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
132 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
133
137 static bool isSelectionAttribute(const AttributePtr& theAttribute);
138
145 static void addValue(const ObjectPtr& theObject, const GeomShapePtr& theShape,
146 const FeaturePtr& theFeature, ModuleBase_IWorkshop* theWorkshop,
147 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
148
155 static void appendShapeIfVisible(ModuleBase_IWorkshop* theWorkshop,
156 const ObjectPtr& theObject,
157 GeomShapePtr theGeomShape,
158 QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
159
163 static void fillShapeList(const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
164 ModuleBase_IWorkshop* theWorkshop,
165 NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& theShapeToPrsMap);
166
167private:
169 NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)> myShapeToPrsMap;
170
171 ModuleBase_IWorkshop* myWorkshop;
172 Quantity_Color myShapeColor;
173
175 bool myUseAISWidth;
176
177 friend class PartSet_CustomPrs;
178};
179
180
181#endif
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
This is the module custom presentation, which manage an AIS presentation, that can be filled by a fea...
Definition: PartSet_CustomPrs.h:46
A redefinition of standard AIS Interactive Object in order to provide colored presentation of a list ...
Definition: PartSet_OperationPrs.h:62
virtual DEFINE_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape) protected void ComputeSelection(const Handle &aSelection, const Standard_Integer aMode)
Redefinition of virtual function.
Definition: PartSet_OperationPrs.cpp:172
PartSet_OperationPrs(ModuleBase_IWorkshop *theWorkshop)
Constructor.
Definition: PartSet_OperationPrs.cpp:75
void useAISWidth()
Switch on using of the AIS presentation with of the shape object increased on the delta.
Definition: PartSet_OperationPrs.cpp:108
void setShapeColor(const Quantity_Color &theColor)
Sets the colors for the presentation compute.
Definition: PartSet_OperationPrs.cpp:103
bool hasShapes()
Returns true if the feature contains shapes or results.
Definition: PartSet_OperationPrs.cpp:98
NCollection_DataMap< TopoDS_Shape, Handle > & shapesMap()
list of visualized shapes
Definition: PartSet_OperationPrs.cpp:178
Displayer.
Definition: XGUI_Displayer.h:172