30a1b24e |
1 | // Created on: 2018-12-12 |
2 | // Created by: Olga SURYANINOVA |
3 | // Copyright (c) 2018 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 _AIS_CameraFrustum_HeaderFile |
17 | #define _AIS_CameraFrustum_HeaderFile |
18 | |
19 | #include <AIS_InteractiveObject.hxx> |
20 | |
21 | class Graphic3d_ArrayOfSegments; |
22 | class Graphic3d_ArrayOfTriangles; |
23 | |
24 | //! Presentation for drawing camera frustum. |
25 | //! Default configuration is built with filling and some transparency. |
26 | class AIS_CameraFrustum : public AIS_InteractiveObject |
27 | { |
28 | DEFINE_STANDARD_RTTIEXT(AIS_CameraFrustum, AIS_InteractiveObject) |
29 | public: |
30 | |
31 | //! Selection modes supported by this object |
32 | enum SelectionMode |
33 | { |
34 | SelectionMode_Edges = 0, //!< detect by edges (default) |
35 | SelectionMode_Volume = 1, //!< detect by volume |
36 | }; |
37 | |
38 | public: |
39 | |
40 | //! Constructs camera frustum with default configuration. |
41 | Standard_EXPORT AIS_CameraFrustum(); |
42 | |
43 | //! Sets camera frustum. |
44 | Standard_EXPORT void SetCameraFrustum (const Handle(Graphic3d_Camera)& theCamera); |
45 | |
46 | //! Setup custom color. |
47 | Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; |
48 | |
49 | //! Restore default color. |
50 | Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; |
51 | |
52 | //! Restore transparency setting. |
53 | Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; |
54 | |
55 | //! Return true if specified display mode is supported. |
56 | Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE; |
57 | |
58 | protected: |
59 | |
60 | //! Computes presentation of camera frustum. |
61 | Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr, |
62 | const Handle(Prs3d_Presentation)& thePrs, |
63 | const Standard_Integer theMode) Standard_OVERRIDE; |
64 | |
65 | //! Compute selection. |
66 | Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, |
67 | const Standard_Integer theMode) Standard_OVERRIDE; |
68 | |
69 | private: |
70 | |
71 | //! Fills triangles primitive array for camera frustum filling. |
72 | void fillTriangles(); |
73 | |
74 | //! Fills polylines primitive array for camera frustum borders. |
75 | void fillBorders(); |
76 | |
77 | protected: |
78 | |
79 | NCollection_Array1<Graphic3d_Vec3d> myPoints; //!< Array of points |
80 | Handle(Graphic3d_ArrayOfTriangles) myTriangles; //!< Triangles for camera frustum filling |
81 | Handle(Graphic3d_ArrayOfSegments) myBorders; //!< Segments for camera frustum borders |
82 | |
83 | }; |
84 | |
85 | #endif // _AIS_CameraFrustum_HeaderFile |