Salome HOME
4c9ac320b12368c8b62d93a62071f320b558de30
[modules/shaper.git] / src / PartSet / PartSet_ResultSketchPrs.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
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_ResultSketchPrs_H
21 #define PartSet_ResultSketchPrs_H
22
23 #include "ModuleBase.h"
24
25 #include <ModelAPI_Result.h>
26
27 #include <ViewerData_AISShape.hxx>
28
29 #include <TopoDS_Compound.hxx>
30
31 DEFINE_STANDARD_HANDLE(PartSet_ResultSketchPrs, ViewerData_AISShape)
32
33 /**
34 * \ingroup GUI
35 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour 
36 * for wire presentations based in a one plane
37 */
38 class PartSet_ResultSketchPrs: public ViewerData_AISShape
39 {
40 public:
41   /// Constructor
42   /// \param theResult a result object
43   Standard_EXPORT PartSet_ResultSketchPrs(ResultPtr theResult);
44
45   DEFINE_STANDARD_RTTIEXT(PartSet_ResultSketchPrs, ViewerData_AISShape)
46 protected:
47   /// Redefinition of virtual function
48   Standard_EXPORT virtual void Compute(
49     const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
50     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
51
52   /// Redefinition of virtual function
53   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
54     const Standard_Integer theMode) ;
55
56 private:
57   /// Appens sensitive and owners for wires of the given shape into selection
58   /// \param theSelection a current filled selection
59   /// \param theShape a shape
60   /// \param theTypeOfSelection type of selection: VERTEX, EDGE, WIRE
61   void appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection,
62                             const TopoDS_Shape& theShape,
63                             const TopAbs_ShapeEnum& theTypeOfSelection);
64
65   /// Sets color/line style/width of the presentation depending on the parameter state
66   /// \param isAuxiliary a boolean value if the properties are for auxiliary objects
67   void setAuxiliaryPresentationStyle(const bool isAuxiliary);
68
69   /// Fills the containers by the current result
70   /// \param theResultShape contains a shape of the result, it will be set as a Shape of AIS_Shape
71   /// \param theAuxiliaryCompound a compound of auxiliary shapes
72   /// \param theFaceList a list of face shapes
73   void fillShapes(TopoDS_Shape& aResultShape,
74                   TopoDS_Compound& theAuxiliaryCompound,
75                   NCollection_List<TopoDS_Shape>& theFaceList);
76
77   /// Reference to result object
78   ResultPtr myResult;
79
80   /// Original shape of the result object
81   TopoDS_Shape myOriginalShape;
82
83   /// Compound of auxiliary shapes
84   TopoDS_Compound myAuxiliaryCompound;
85
86   /// List of faces
87   //std::list<std::shared_ptr<GeomAPI_Shape> > myFacesList;
88   NCollection_List<TopoDS_Shape> mySketchFaceList;
89 };
90
91
92 #endif