02e084f857ffb3c4440528253e5374c1abb28c61
[occt.git] / src / SelectMgr / SelectMgr_SensitiveEntity.hxx
1 // Created on: 2014-08-15
2 // Created by: Varvara POSKONINA
3 // Copyright (c) 2005-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _SelectMgr_SensitiveEntity_HeaderFile
17 #define _SelectMgr_SensitiveEntity_HeaderFile
18
19 #include <SelectBasics_SensitiveEntity.hxx>
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 //! The purpose of this class is to mark sensitive entities selectable or not
24 //! depending on current active selection of parent object for proper BVH traverse
25 class SelectMgr_SensitiveEntity : public Standard_Transient
26 {
27 public:
28
29   //! Creates new inactive for selection object with base entity theEntity
30   Standard_EXPORT SelectMgr_SensitiveEntity (const Handle(Select3D_SensitiveEntity)& theEntity);
31
32   ~SelectMgr_SensitiveEntity() {}
33
34   //! Clears up all resources and memory
35   Standard_EXPORT void Clear();
36
37   //! Returns related instance of SelectBasics class
38   const Handle(Select3D_SensitiveEntity)& BaseSensitive() const { return mySensitive; }
39
40   //! Returns true if this entity belongs to the active selection
41   //! mode of parent object
42   Standard_Boolean IsActiveForSelection() const { return myIsActiveForSelection; }
43
44   //! Marks entity as inactive for selection
45   void ResetSelectionActiveStatus() const { myIsActiveForSelection = Standard_False; }
46
47   //! Marks entity as active for selection
48   void SetActiveForSelection() const { myIsActiveForSelection = Standard_True; }
49
50   DEFINE_STANDARD_RTTIEXT(SelectMgr_SensitiveEntity,Standard_Transient) // Type definition
51
52 private:
53
54   Handle(Select3D_SensitiveEntity) mySensitive;      //!< Related SelectBasics entity
55   mutable Standard_Boolean         myIsActiveForSelection;       //!< Selection activity status
56 };
57
58 DEFINE_STANDARD_HANDLE(SelectMgr_SensitiveEntity, Standard_Transient)
59
60 #endif // _SelectMgr_SensitiveEntity_HeaderFile