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