42cf5bc1 |
1 | // Created on: 2008-05-06 |
2 | // Created by: Vladislav ROMASHKO |
3 | // Copyright (c) 2008-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 _Voxel_Prs_HeaderFile |
17 | #define _Voxel_Prs_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Type.hxx> |
21 | |
22 | #include <Standard_Address.hxx> |
23 | #include <AIS_InteractiveObject.hxx> |
24 | #include <Voxel_VoxelDisplayMode.hxx> |
25 | #include <Quantity_HArray1OfColor.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | #include <PrsMgr_PresentationManager3d.hxx> |
29 | #include <SelectMgr_Selection.hxx> |
30 | #include <Standard_Boolean.hxx> |
31 | #include <Standard_Byte.hxx> |
32 | class Poly_Triangulation; |
33 | class Quantity_Color; |
34 | class Prs3d_Presentation; |
35 | |
36 | |
37 | class Voxel_Prs; |
38 | DEFINE_STANDARD_HANDLE(Voxel_Prs, AIS_InteractiveObject) |
39 | |
40 | //! Interactive object for voxels. |
41 | class Voxel_Prs : public AIS_InteractiveObject |
42 | { |
43 | |
44 | public: |
45 | |
46 | |
47 | //! An empty constructor. |
48 | Standard_EXPORT Voxel_Prs(); |
49 | |
50 | //! <theVoxels> is a Voxel_BoolDS* object. |
51 | Standard_EXPORT void SetBoolVoxels (const Standard_Address theVoxels); |
52 | |
53 | //! <theVoxels> is a Voxel_ColorDS* object. |
54 | Standard_EXPORT void SetColorVoxels (const Standard_Address theVoxels); |
55 | |
56 | //! <theVoxels> is a Voxel_ROctBoolDS* object. |
57 | Standard_EXPORT void SetROctBoolVoxels (const Standard_Address theVoxels); |
58 | |
59 | //! Sets a triangulation for visualization. |
60 | Standard_EXPORT void SetTriangulation (const Handle(Poly_Triangulation)& theTriangulation); |
61 | |
62 | //! Sets a display mode for voxels. |
63 | Standard_EXPORT void SetDisplayMode (const Voxel_VoxelDisplayMode theMode); |
64 | |
65 | //! Defines the color of points, quadrangles ... for BoolDS. |
66 | Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; |
67 | |
68 | //! Defines the color of points, quadrangles... for ColorDS. |
69 | //! For ColorDS the size of array is 0 .. 15. |
70 | //! 0 - means no color, this voxel is not drawn. |
71 | Standard_EXPORT void SetColors (const Handle(Quantity_HArray1OfColor)& theColors); |
72 | |
73 | //! Defines the size of points for all types of voxels. |
74 | Standard_EXPORT void SetPointSize (const Standard_Real theSize); |
75 | |
76 | //! Defines the size of quadrangles in per cents (0 .. 100). |
77 | Standard_EXPORT void SetQuadrangleSize (const Standard_Integer theSize); |
78 | |
79 | //! Defines the transparency value [0 .. 1] for quadrangular visualization. |
80 | Standard_EXPORT virtual void SetTransparency (const Standard_Real theTransparency) Standard_OVERRIDE; |
81 | |
82 | //! Highlights a voxel. |
83 | //! It doesn't re-computes the whole interactive object, |
84 | //! but only marks a voxels as "highlighted". |
85 | //! The voxel becomes highlighted on next swapping of buffers. |
86 | //! In order to unhighlight a voxel, set ix = iy = iz = -1. |
87 | Standard_EXPORT void Highlight (const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz); |
88 | |
89 | //! A destructor of presentation data. |
90 | Standard_EXPORT void Destroy(); |
91 | ~Voxel_Prs() |
92 | { |
93 | Destroy(); |
94 | } |
95 | |
96 | //! Simplifies visualization of voxels in case of view rotation, panning and zooming. |
97 | Standard_EXPORT void SetDegenerateMode (const Standard_Boolean theDegenerate); |
98 | |
99 | //! GL lists accelerate view rotation, panning and zooming operations, but |
100 | //! it takes additional memory... |
101 | //! It is up to the user of this interactive object to decide whether |
102 | //! he has enough memory and may use GL lists or |
103 | //! he is lack of memory and usage of GL lists is not recommended. |
104 | //! By default, usage of GL lists is on. |
105 | //! Also, as I noticed, the view without GL lists looks more precisely. |
106 | Standard_EXPORT void SetUsageOfGLlists (const Standard_Boolean theUsage); |
107 | |
108 | //! Switches visualization of points from smooth to rough. |
109 | Standard_EXPORT void SetSmoothPoints (const Standard_Boolean theSmooth); |
110 | |
111 | //! Defines min-max values for visualization of voxels of ColorDS structure. |
112 | //! By default, min value = 1, max value = 15 (all non-zero values). |
113 | Standard_EXPORT void SetColorRange (const Standard_Byte theMinValue, const Standard_Byte theMaxValue); |
114 | |
115 | //! Defines the displayed area of voxels. |
116 | //! By default, the range is equal to the box of voxels (all voxels are displayed). |
117 | Standard_EXPORT void SetSizeRange (const Standard_Real theDisplayedXMin, const Standard_Real theDisplayedXMax, const Standard_Real theDisplayedYMin, const Standard_Real theDisplayedYMax, const Standard_Real theDisplayedZMin, const Standard_Real theDisplayedZMax); |
118 | |
119 | |
120 | |
121 | DEFINE_STANDARD_RTTI(Voxel_Prs,AIS_InteractiveObject) |
122 | |
123 | protected: |
124 | |
125 | |
126 | Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0) Standard_OVERRIDE; |
127 | |
128 | |
129 | |
a521d90d |
130 | protected: |
42cf5bc1 |
131 | |
132 | |
133 | Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode); |
134 | |
135 | //! Allocates the data structure of visualization. |
136 | Standard_EXPORT void Allocate(); |
137 | |
138 | Standard_Address myVisData; |
139 | |
140 | |
141 | }; |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | #endif // _Voxel_Prs_HeaderFile |