d33222c1 |
1 | // Created on: 2014-08-13 |
2 | // Created by: Maxim GLIBIN |
3 | // Copyright (c) 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 _AIS_PointCloud_HeaderFile |
17 | #define _AIS_PointCloud_HeaderFile |
18 | |
19 | #include <AIS.hxx> |
20 | #include <AIS_InteractiveObject.hxx> |
21 | #include <Bnd_Box.hxx> |
22 | #include <Graphic3d_ArrayOfPoints.hxx> |
23 | #include <Quantity_HArray1OfColor.hxx> |
24 | #include <Standard.hxx> |
ec357c5c |
25 | #include <Standard_Type.hxx> |
d33222c1 |
26 | #include <Standard_Macro.hxx> |
27 | #include <TColgp_HArray1OfDir.hxx> |
28 | #include <TColgp_HArray1OfPnt.hxx> |
29 | |
c04c30b3 |
30 | class AIS_PointCloud; |
d33222c1 |
31 | DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject) |
32 | |
33 | //! Interactive object for set of points. |
34 | //! The presentation supports two display modes: |
35 | //! - Points. |
36 | //! - Bounding box for highlighting. |
37 | //! Presentation provides selection by bouding box. |
38 | //! Selection and consequently highlighting can disabled by |
39 | //! setting default selection mode to -1. There will be no way |
40 | //! to select object from interactive view. Any calls to |
41 | //! AIS_InteractiveContext::AddOrRemoveSelected should be also prohibited, |
42 | //! to avoid programmatic highlighting (workaround is setting non-supported |
43 | //! hilight mode, e.g. 100); |
44 | class AIS_PointCloud : public AIS_InteractiveObject |
45 | { |
46 | |
47 | public: |
48 | |
49 | //! Display modes supported by this Point Cloud object |
50 | enum DisplayMode |
51 | { |
52 | DM_Points = 0, //!< display as normal points, default presentation |
53 | DM_BndBox = 2 //!< display as bounding box, default for highlighting |
54 | }; |
55 | |
56 | public: |
57 | |
58 | //! Constructor. |
59 | Standard_EXPORT AIS_PointCloud(); |
60 | |
61 | //! Sets the points from array of points. |
62 | //! Method will not copy the input data - array will be stored as handle. |
63 | //! @param thePoints [in] the array of points |
64 | Standard_EXPORT virtual void SetPoints (const Handle(Graphic3d_ArrayOfPoints)& thePoints); |
65 | |
66 | //! Sets the points with optional colors. |
67 | //! The input data will be copied into internal buffer. |
68 | //! The input arrays should have equal length, otherwise |
69 | //! the presentation will not be computed and displayed. |
70 | //! @param theCoords [in] the array of coordinates |
71 | //! @param theColors [in] optional array of colors |
72 | //! @param theNormals [in] optional array of normals |
73 | Standard_EXPORT virtual void SetPoints (const Handle(TColgp_HArray1OfPnt)& theCoords, |
74 | const Handle(Quantity_HArray1OfColor)& theColors = NULL, |
75 | const Handle(TColgp_HArray1OfDir)& theNormals = NULL); |
76 | |
77 | public: |
78 | |
79 | //! Get the points array. |
80 | //! Method might be overridden to fill in points array dynamically from application data structures. |
81 | //! @return the array of points |
82 | Standard_EXPORT virtual const Handle(Graphic3d_ArrayOfPoints) GetPoints() const; |
83 | |
84 | //! Get bounding box for presentation. |
85 | Standard_EXPORT virtual Bnd_Box GetBoundingBox() const; |
86 | |
87 | public: |
88 | |
89 | //! Setup custom color. Affects presentation only when no per-point color attribute has been assigned. |
79104795 |
90 | Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE; |
d33222c1 |
91 | |
92 | //! Setup custom color. Affects presentation only when no per-point color attribute has been assigned. |
79104795 |
93 | Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; |
d33222c1 |
94 | |
95 | //! Restore default color. |
79104795 |
96 | Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; |
d33222c1 |
97 | |
98 | //! Setup custom material. Affects presentation only when normals are defined. |
79104795 |
99 | Standard_EXPORT virtual void SetMaterial (const Graphic3d_NameOfMaterial theMatName) Standard_OVERRIDE; |
d33222c1 |
100 | |
101 | //! Setup custom material. Affects presentation only when normals are defined. |
79104795 |
102 | Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theMat) Standard_OVERRIDE; |
d33222c1 |
103 | |
104 | //! Restore default material. |
79104795 |
105 | Standard_EXPORT virtual void UnsetMaterial() Standard_OVERRIDE; |
d33222c1 |
106 | |
107 | protected: |
108 | |
109 | //! Prepare presentation for this object. |
110 | Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr, |
111 | const Handle(Prs3d_Presentation)& thePrs, |
79104795 |
112 | const Standard_Integer theMode) Standard_OVERRIDE; |
d33222c1 |
113 | |
114 | //! Prepare selection for this object. |
115 | Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, |
79104795 |
116 | const Standard_Integer theMode) Standard_OVERRIDE; |
d33222c1 |
117 | |
118 | private: |
119 | |
120 | Handle(Graphic3d_ArrayOfPoints) myPoints; //!< points array for presentation |
121 | Bnd_Box myBndBox; //!< bounding box for presentation |
122 | |
123 | public: |
124 | |
ec357c5c |
125 | DEFINE_STANDARD_RTTI(AIS_PointCloud, AIS_InteractiveObject) |
d33222c1 |
126 | |
127 | }; |
128 | |
129 | #endif // _AIS_PointCloud_HeaderFile |