1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
20 #ifndef ModuleBase_ResultPrs_H
21 #define ModuleBase_ResultPrs_H
23 #include "ModuleBase.h"
25 #include <ModelAPI_Result.h>
27 #include <ViewerData_AISShape.hxx>
28 #include <Standard_DefineHandle.hxx>
29 #include <StdSelect_BRepOwner.hxx>
33 DEFINE_STANDARD_HANDLE(ModuleBase_BRepOwner, StdSelect_BRepOwner)
37 * A redefinition of standard BRep Owner in order to provide specific selection
38 * of CompSolid objects. This owner is created only for selection mode TopAbs_COMPSOLID
40 class ModuleBase_BRepOwner: public StdSelect_BRepOwner
44 /// \param aShape an owner shape
45 /// \param aPriority drawig priority
46 /// \param ComesFromDecomposition decomposition flag
47 ModuleBase_BRepOwner(const TopoDS_Shape& aShape,
48 const Standard_Integer aPriority = 0,
49 const Standard_Boolean ComesFromDecomposition = Standard_False)
50 : StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {}
52 /// Highlight the presentation with the given color
53 /// \param aPM a presentations manager
54 /// \param theStyle a style of presentation
55 /// \param aMode a drawing mode
56 virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM,
57 const Handle(Graphic3d_HighlightStyle)& theStyle, const Standard_Integer aMode = 0)
59 Selectable()->HilightOwnerWithColor(aPM, theStyle, this);
62 DEFINE_STANDARD_RTTIEXT(ModuleBase_BRepOwner, StdSelect_BRepOwner)
67 DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape)
71 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour
72 * for wire presentations based in a one plane
74 class ModuleBase_ResultPrs: public ViewerData_AISShape
78 Sel_Result = TopAbs_SHAPE + 1 /// it should be combined with Compsolid results, so it is not
79 /// the Shape type. It is not defined in XML as compound type
80 /// because this type is processed as shape with compounds inside.
85 /// \param theResult a result object
86 Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
88 //! Method which draws selected owners ( for fast presentation draw )
89 Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
90 const SelectMgr_SequenceOfOwner& theOwners);
92 //! Method which hilight an owner belonging to
93 //! this selectable object ( for fast presentation draw )
94 Standard_EXPORT virtual void HilightOwnerWithColor(
95 const Handle(PrsMgr_PresentationManager3d)& thePM,
96 const Handle(Graphic3d_HighlightStyle)& theStyle,
97 const Handle(SelectMgr_EntityOwner)& theOwner);
99 /// Returns result object
100 Standard_EXPORT ResultPtr getResult() const { return myResult; }
102 /// Returns selection priorities that will be added to created selection owner
103 /// \return integer value
104 Standard_EXPORT int getAdditionalSelectionPriority() const
105 { return myAdditionalSelectionPriority; }
107 /// Appends a special priority for the mode of selection
108 /// \param theSelectionMode a mode of selection, used in ComputeSelection
109 /// \param thePriority a new priority value
110 Standard_EXPORT void setAdditionalSelectionPriority(const int thePriority);
112 DEFINE_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape)
114 /// Redefinition of virtual function
115 Standard_EXPORT virtual void Compute(
116 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
117 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
119 /// Redefinition of virtual function
120 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
121 const Standard_Integer aMode) ;
124 /// Appens sensitive and owners for wires of the given shape into selection
125 /// \param theSelection a current filled selection
126 /// \param theShape a shape
127 void appendWiresSelection(const Handle(SelectMgr_Selection)& theSelection,
128 const TopoDS_Shape& theShape);
130 /// Reference to result object
133 /// Original shape of the result object
134 TopoDS_Shape myOriginalShape;
136 /// selection priority that will be added to the standard
137 /// selection priority of the selection entity
138 int myAdditionalSelectionPriority;