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