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