0024023: Revamp the OCCT Handle -- general
[occt.git] / src / IVtkOCC / IVtkOCC_SelectableObject.hxx
1 // Created on: 2011-10-20 
2 // Created by: Roman KOZLOV
3 // Copyright (c) 2011-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 __IVTKOCC_SELECTABLEOBJECT_H__
17 #define __IVTKOCC_SELECTABLEOBJECT_H__
18
19 #include <Bnd_Box.hxx>
20 #include <IVtkOCC_Shape.hxx>
21 #include <Prs3d_Drawer.hxx>
22 #include <SelectMgr_SelectableObject.hxx>
23 #include <SelectMgr_Selection.hxx>
24
25 // -----------------------------------------------------------------------------
26 //! @class IVtkOCC_SelectableObject
27 //! @brief Class with selection primitives used by OCCT selection algorithm.
28 class IVtkOCC_SelectableObject : public SelectMgr_SelectableObject
29 {
30 public:
31
32   //! Constructs a selectable object initialized by the given shape
33   //! @param [in] theShape Selectable shape
34   IVtkOCC_SelectableObject (const IVtkOCC_Shape::Handle& theShape);
35
36   //! Constructs uninitialized selectable object.
37   //! setShape() should be called later.
38   IVtkOCC_SelectableObject();
39
40   //! Sets the selectable shape
41   //! @param [in] theShape Selectable shape
42   void SetShape (const IVtkOCC_Shape::Handle& theShape);
43
44   const IVtkOCC_Shape::Handle&  GetShape() const { return myShape; };
45
46   //! Returns bounding box of object
47   Standard_EXPORT virtual void BoundingBox (Bnd_Box& theBndBox) Standard_OVERRIDE;
48
49   DEFINE_STANDARD_RTTI(IVtkOCC_SelectableObject, SelectMgr_SelectableObject)
50
51 private: 
52
53   //! Internal method, computes selection data for viewer selector
54   //! Inspired by AIS_Shape::ComputeSelection() from OCCT 6.5.1
55   //! @param [in] selection container for sensitive primitives
56   //! @param [in] mode Selection mode
57   void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
58                          const Standard_Integer theMode);
59
60   const Bnd_Box& BoundingBox();
61
62   IVtkOCC_Shape::Handle myShape;
63   Bnd_Box               myBndBox;
64   Handle(Prs3d_Drawer)  myOCCTDrawer;
65 };
66
67 DEFINE_STANDARD_HANDLE( IVtkOCC_SelectableObject, SelectMgr_SelectableObject )
68
69 #endif // __IVTKOCC_SELECTABLEOBJECT_H__