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 <NCollection_List.hxx>
29 #include <ViewerData_AISShape.hxx>
30 #include <Standard_DefineHandle.hxx>
34 DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape)
38 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour
39 * for wire presentations based in a one plane
41 class ModuleBase_ResultPrs: public ViewerData_AISShape
45 Sel_Result = TopAbs_SHAPE + 1 /// it should be combined with Compsolid results, so it is not
46 /// the Shape type. It is not defined in XML as compound type
47 /// because this type is processed as shape with compounds inside.
52 /// \param theResult a result object
53 Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
55 //! Method which draws selected owners ( for fast presentation draw )
56 Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
57 const SelectMgr_SequenceOfOwner& theOwners);
59 //! Method which hilight an owner belonging to
60 //! this selectable object ( for fast presentation draw )
61 Standard_EXPORT virtual void HilightOwnerWithColor(
62 const Handle(PrsMgr_PresentationManager3d)& thePM,
63 const Handle(Graphic3d_HighlightStyle)& theStyle,
64 const Handle(SelectMgr_EntityOwner)& theOwner);
66 /// Returns result object
67 Standard_EXPORT ResultPtr getResult() const { return myResult; }
69 /// Returns selection priorities that will be added to created selection owner
70 /// \return integer value
71 Standard_EXPORT int getAdditionalSelectionPriority() const
72 { return myAdditionalSelectionPriority; }
74 /// Appends a special priority for the mode of selection
75 /// \param theSelectionMode a mode of selection, used in ComputeSelection
76 /// \param thePriority a new priority value
77 Standard_EXPORT void setAdditionalSelectionPriority(const int thePriority);
79 /// Change presentation to have given shape hidden.
80 /// It suports FACE type of the shape to be hidden.
81 /// If presentation type is greater than FACE, the SHELL with be shown with the FACE hidden
82 /// It is possible to hide more than one FACE by calling the method with given FACES
83 /// Visual state of the face is controlled by the second parameter
84 /// \param theShapes a container of shape objects
85 /// \returns true if the presentation is changed, or false (if for example it was hidden)
86 Standard_EXPORT bool setSubShapeHidden(const NCollection_List<TopoDS_Shape>& theShapes);
88 /// Returns true if there are no hidden sub shapes or original shape has at least one not hidden
89 /// \param theShapeToSkip the shape should be interpreted as additional hidden in the presentation
90 /// \return boolean value
91 Standard_EXPORT bool hasSubShapeVisible(const TopoDS_Shape& theShapeToSkip);
93 DEFINE_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape)
96 /// Redefinition of virtual function
97 Standard_EXPORT virtual void Compute(
98 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
99 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
101 /// Redefinition of virtual function
102 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
103 const Standard_Integer theMode) ;
106 /// If the shape of this presentation is Vertex, it appends custom sensitive and owners for it.
107 /// Owner is a usual Brep owner with "isDecomposite" in true. It is necessary to have "Ring"
108 /// highlight/selected marker.
109 /// \param theSelection a current filled selection
110 /// \param theMode a selection mode
111 /// \return true if the owner is created
112 bool appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection,
113 const Standard_Integer theMode);
115 /// Reference to result object
118 /// Original shape of the result object
119 TopoDS_Shape myOriginalShape;
121 /// Container of original Shape sub shape to be hidden and not selectable
122 NCollection_List<TopoDS_Shape> myHiddenSubShapes;
124 /// selection priority that will be added to the standard
125 /// selection priority of the selection entity
126 int myAdditionalSelectionPriority;