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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ModuleBase_ResultPrs_H
22 #define ModuleBase_ResultPrs_H
24 #include "ModuleBase.h"
26 #include <ModelAPI_Result.h>
28 #include <ViewerData_AISShape.hxx>
29 #include <Standard_DefineHandle.hxx>
30 #include <StdSelect_BRepOwner.hxx>
34 DEFINE_STANDARD_HANDLE(ModuleBase_BRepOwner, StdSelect_BRepOwner)
38 * A redefinition of standard BRep Owner in order to provide specific selection
39 * of CompSolid objects. This owner is created only for selection mode TopAbs_COMPSOLID
41 class ModuleBase_BRepOwner: public StdSelect_BRepOwner
45 /// \param aShape an owner shape
46 /// \param aPriority drawig priority
47 /// \param ComesFromDecomposition decomposition flag
48 ModuleBase_BRepOwner(const TopoDS_Shape& aShape,
49 const Standard_Integer aPriority = 0,
50 const Standard_Boolean ComesFromDecomposition = Standard_False)
51 : StdSelect_BRepOwner(aShape, aPriority, ComesFromDecomposition) {}
53 /// Highlight the presentation with the given color
54 /// \param aPM a presentations manager
55 /// \param theStyle a style of presentation
56 /// \param theMode a drawing mode
57 virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM,
58 const Handle(Graphic3d_HighlightStyle)& theStyle, const Standard_Integer theMode = 0)
60 Selectable()->HilightOwnerWithColor(aPM, theStyle, this);
63 DEFINE_STANDARD_RTTIEXT(ModuleBase_BRepOwner, StdSelect_BRepOwner)
68 DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape)
72 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour
73 * for wire presentations based in a one plane
75 class ModuleBase_ResultPrs: public ViewerData_AISShape
79 Sel_Result = TopAbs_SHAPE + 1 /// it should be combined with Compsolid results, so it is not
80 /// the Shape type. It is not defined in XML as compound type
81 /// because this type is processed as shape with compounds inside.
86 /// \param theResult a result object
87 Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
89 //! Method which draws selected owners ( for fast presentation draw )
90 Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
91 const SelectMgr_SequenceOfOwner& theOwners);
93 //! Method which hilight an owner belonging to
94 //! this selectable object ( for fast presentation draw )
95 Standard_EXPORT virtual void HilightOwnerWithColor(
96 const Handle(PrsMgr_PresentationManager3d)& thePM,
97 const Handle(Graphic3d_HighlightStyle)& theStyle,
98 const Handle(SelectMgr_EntityOwner)& theOwner);
100 /// Returns result object
101 Standard_EXPORT ResultPtr getResult() const { return myResult; }
103 /// Returns selection priorities that will be added to created selection owner
104 /// \return integer value
105 Standard_EXPORT int getAdditionalSelectionPriority() const
106 { return myAdditionalSelectionPriority; }
108 /// Appends a special priority for the mode of selection
109 /// \param theSelectionMode a mode of selection, used in ComputeSelection
110 /// \param thePriority a new priority value
111 Standard_EXPORT void setAdditionalSelectionPriority(const int thePriority);
113 DEFINE_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape)
115 /// Redefinition of virtual function
116 Standard_EXPORT virtual void Compute(
117 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
118 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
120 /// Redefinition of virtual function
121 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
122 const Standard_Integer theMode) ;
125 /// If the shape of this presentation is Vertex, it appends custom sensitive and owners for it.
126 /// Owner is a usual Brep owner with "isDecomposite" in true. It is necessary to have "Ring"
127 /// highlight/selected marker.
128 /// \param theSelection a current filled selection
129 /// \param theMode a selection mode
130 /// \return true if the owner is created
131 bool appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection,
132 const Standard_Integer theMode);
134 /// Reference to result object
137 /// Original shape of the result object
138 TopoDS_Shape myOriginalShape;
140 /// selection priority that will be added to the standard
141 /// selection priority of the selection entity
142 int myAdditionalSelectionPriority;