42cf5bc1 |
1 | // Created on: 2003-10-10 |
2 | // Created by: Alexander SOLOVYOV |
3 | // Copyright (c) 2003-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 _MeshVS_PrsBuilder_HeaderFile |
17 | #define _MeshVS_PrsBuilder_HeaderFile |
18 | |
42cf5bc1 |
19 | #include <MeshVS_MeshPtr.hxx> |
42cf5bc1 |
20 | #include <PrsMgr_PresentationManager3d.hxx> |
7dd7c146 |
21 | #include <Prs3d_Presentation.hxx> |
42cf5bc1 |
22 | #include <MeshVS_DisplayModeFlags.hxx> |
23 | #include <MeshVS_BuilderPriority.hxx> |
24 | #include <TColStd_PackedMapOfInteger.hxx> |
7dd7c146 |
25 | |
42cf5bc1 |
26 | class MeshVS_DataSource; |
27 | class MeshVS_Drawer; |
28 | class MeshVS_Mesh; |
0ef04197 |
29 | class Select3D_SensitiveEntity; |
30 | class SelectMgr_EntityOwner; |
42cf5bc1 |
31 | |
25e59720 |
32 | DEFINE_STANDARD_HANDLE(MeshVS_PrsBuilder, Standard_Transient) |
42cf5bc1 |
33 | |
34 | //! This class is parent for all builders using in MeshVS_Mesh. |
35 | //! It provides base fields and methods all buildes need. |
25e59720 |
36 | class MeshVS_PrsBuilder : public Standard_Transient |
42cf5bc1 |
37 | { |
38 | |
39 | public: |
40 | |
41 | |
42 | //! Builds presentation of certain type of data. |
43 | //! Prs is presentation object which this method constructs. |
44 | //! IDs is set of numeric identificators forming object appearance. |
45 | //! IDsToExclude is set of IDs to exclude from processing. If some entity |
46 | //! has been excluded, it is not processed by other builders. |
47 | //! IsElement indicates, IDs is identificators of nodes or elements. |
48 | //! DisplayMode is numeric constant describing display mode (see MeshVS_DisplayModeFlags.hxx) |
49 | Standard_EXPORT virtual void Build (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Boolean IsElement, const Standard_Integer DisplayMode) const = 0; |
50 | |
51 | //! This method is called to build presentation of custom elements (they have MeshVS_ET_0D type). |
52 | //! IDs is set of numeric identificators of elements for custom building. |
53 | //! IDsToExclude is set of IDs to exclude from processing. If some entity |
54 | //! has been excluded, it is not processed by other builders. |
55 | //! DisplayMode is numeric constant describing display mode (see MeshVS_DisplayModeFlags.hxx) |
56 | Standard_EXPORT virtual void CustomBuild (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Integer DisplayMode) const; |
57 | |
58 | //! This method is called to build sensitive of custom elements ( they have MeshVS_ET_0D type ) |
0ef04197 |
59 | Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) CustomSensitiveEntity (const Handle(SelectMgr_EntityOwner)& Owner, const Standard_Integer SelectMode) const; |
42cf5bc1 |
60 | |
61 | //! Returns flags, assigned with builder during creation |
62 | Standard_EXPORT Standard_Integer GetFlags() const; |
63 | |
64 | //! Test whether display mode has flags assigned with this builder. |
65 | //! This method has default implementation and can be redefined for advance behavior |
66 | //! Returns Standard_True only if display mode is appropriate for this builder |
67 | Standard_EXPORT virtual Standard_Boolean TestFlags (const Standard_Integer DisplayMode) const; |
68 | |
69 | //! Returns builder ID |
70 | Standard_EXPORT Standard_Integer GetId() const; |
71 | |
72 | //! Returns priority; as priority bigger, as soon builder will be called. |
73 | Standard_EXPORT Standard_Integer GetPriority() const; |
74 | |
75 | //! Returns custom data source or default ( from MeshVS_Mesh ) if custom is NULL |
76 | Standard_EXPORT Handle(MeshVS_DataSource) GetDataSource() const; |
77 | |
78 | //! Change custom data source |
79 | Standard_EXPORT void SetDataSource (const Handle(MeshVS_DataSource)& newDS); |
80 | |
81 | //! Returns custom drawer or default ( from MeshVS_Mesh ) if custom is NULL |
82 | Standard_EXPORT Handle(MeshVS_Drawer) GetDrawer() const; |
83 | |
84 | //! Change custom drawer |
85 | Standard_EXPORT void SetDrawer (const Handle(MeshVS_Drawer)& newDr); |
86 | |
87 | //! Set excluding state. If it is Standard_True, the nodes or elements, processed by current builder |
88 | //! will be noted and next builder won't process its. |
89 | Standard_EXPORT void SetExcluding (const Standard_Boolean state); |
90 | |
91 | //! Read excluding state |
92 | Standard_EXPORT Standard_Boolean IsExcludingOn() const; |
93 | |
94 | //! Set presentation manager for builder |
95 | Standard_EXPORT void SetPresentationManager (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr); |
96 | |
97 | //! Get presentation manager of builder |
98 | Standard_EXPORT Handle(PrsMgr_PresentationManager3d) GetPresentationManager() const; |
99 | |
100 | |
101 | |
102 | |
25e59720 |
103 | DEFINE_STANDARD_RTTIEXT(MeshVS_PrsBuilder,Standard_Transient) |
42cf5bc1 |
104 | |
105 | protected: |
106 | |
107 | |
108 | //! Constructor |
109 | //! Parent is pointer to MeshVS_Mesh object |
110 | //! Flags is set of display modes corresponding to this builder |
111 | //! DS is data source object, from which builder will pick geometry and topological information |
112 | //! Id is numeric identificator of builder. You must set it to positive integer, but if |
113 | //! you set it to -1, constructor will select the smallest integer, not occupied by other builders |
114 | //! Priority is numerical priority constant. As priority bigger, as sooner builder starts during |
115 | //! presentation construction |
116 | Standard_EXPORT MeshVS_PrsBuilder(const Handle(MeshVS_Mesh)& Parent, const MeshVS_DisplayModeFlags& Flags, const Handle(MeshVS_DataSource)& DS, const Standard_Integer Id, const MeshVS_BuilderPriority& Priority = MeshVS_BP_Default); |
117 | |
118 | //! Returns only custom data source |
119 | Standard_EXPORT Handle(MeshVS_DataSource) DataSource() const; |
120 | |
121 | //! Returns only custom drawer |
122 | Standard_EXPORT Handle(MeshVS_Drawer) Drawer() const; |
123 | |
124 | MeshVS_MeshPtr myParentMesh; |
125 | |
126 | |
127 | private: |
128 | |
129 | |
130 | Standard_Boolean myIsExcluding; |
131 | Handle(MeshVS_DataSource) myDataSource; |
132 | Handle(MeshVS_Drawer) myDrawer; |
133 | Standard_Integer myFlags; |
134 | Standard_Integer myId; |
135 | Standard_Integer myPriority; |
136 | Handle(PrsMgr_PresentationManager3d) myPrsMgr; |
137 | |
138 | |
139 | }; |
140 | |
141 | |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | #endif // _MeshVS_PrsBuilder_HeaderFile |