0031221: Visualization - selection filter in context
[occt.git] / src / AIS / AIS_XRTrackedDevice.hxx
1 // Copyright (c) 2020 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _AIS_XRTrackedDevice_HeaderFile
15 #define _AIS_XRTrackedDevice_HeaderFile
16
17 #include <AIS_InteractiveObject.hxx>
18 #include <Aspect_XRTrackedDeviceRole.hxx>
19
20 class Graphic3d_ArrayOfTriangles;
21 class Image_Texture;
22
23 //! Auxiliary textured mesh presentation of tracked XR device.
24 class AIS_XRTrackedDevice : public AIS_InteractiveObject
25 {
26   DEFINE_STANDARD_RTTIEXT(AIS_XRTrackedDevice, AIS_InteractiveObject)
27 public:
28   //! Main constructor.
29   Standard_EXPORT AIS_XRTrackedDevice (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
30                                        const Handle(Image_Texture)& theTexture);
31
32   //! Empty constructor.
33   Standard_EXPORT AIS_XRTrackedDevice();
34
35   //! Return device role.
36   Aspect_XRTrackedDeviceRole Role() const { return myRole; }
37
38   //! Set device role.
39   void SetRole (Aspect_XRTrackedDeviceRole theRole) { myRole = theRole; }
40
41   //! Return laser color.
42   const Quantity_Color& LaserColor() const { return myLaserColor; }
43
44   //! Set laser color.
45   Standard_EXPORT void SetLaserColor (const Quantity_Color& theColor);
46
47   //! Return laser length.
48   Standard_ShortReal LaserLength() const { return myLaserLength; }
49
50   //! Set laser length.
51   Standard_EXPORT void SetLaserLength (Standard_ShortReal theLength);
52
53   //! Return unit scale factor.
54   Standard_ShortReal UnitFactor() const { return myUnitFactor; }
55
56   //! Set unit scale factor.
57   void SetUnitFactor (Standard_ShortReal theFactor) { myUnitFactor = theFactor; }
58
59 protected:
60
61   //! Returns true for 0 mode.
62   virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
63
64   //! Compute presentation.
65   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
66                                         const Handle(Prs3d_Presentation)& thePrs,
67                                         const Standard_Integer theMode) Standard_OVERRIDE;
68
69   //! Compute selection.
70   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
71                                                  const Standard_Integer theMode) Standard_OVERRIDE;
72
73   //! Compute laser ray presentation.
74   Standard_EXPORT void computeLaserRay();
75
76 private:
77   //! Texture holder.
78   class XRTexture;
79
80 private:
81
82   Handle(Graphic3d_Group) myRayGroup;
83
84   Handle(Graphic3d_ArrayOfTriangles) myTris;
85   Quantity_Color             myLaserColor;
86   Standard_ShortReal         myLaserLength;
87   Standard_ShortReal         myUnitFactor;
88   Aspect_XRTrackedDeviceRole myRole;
89   Standard_Boolean           myToShowAxes;
90 };
91
92 #endif // _AIS_XRTrackedDevice_HeaderFile