1 // Created on: 2003-10-10
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2003-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _MeshVS_PrsBuilder_HeaderFile
17 #define _MeshVS_PrsBuilder_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
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;
33 class Prs3d_Presentation;
34 class SelectBasics_SensitiveEntity;
35 class SelectBasics_EntityOwner;
38 class MeshVS_PrsBuilder;
39 DEFINE_STANDARD_HANDLE(MeshVS_PrsBuilder, MMgt_TShared)
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
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;
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;
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;
68 //! Returns flags, assigned with builder during creation
69 Standard_EXPORT Standard_Integer GetFlags() const;
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;
76 //! Returns builder ID
77 Standard_EXPORT Standard_Integer GetId() const;
79 //! Returns priority; as priority bigger, as soon builder will be called.
80 Standard_EXPORT Standard_Integer GetPriority() const;
82 //! Returns custom data source or default ( from MeshVS_Mesh ) if custom is NULL
83 Standard_EXPORT Handle(MeshVS_DataSource) GetDataSource() const;
85 //! Change custom data source
86 Standard_EXPORT void SetDataSource (const Handle(MeshVS_DataSource)& newDS);
88 //! Returns custom drawer or default ( from MeshVS_Mesh ) if custom is NULL
89 Standard_EXPORT Handle(MeshVS_Drawer) GetDrawer() const;
91 //! Change custom drawer
92 Standard_EXPORT void SetDrawer (const Handle(MeshVS_Drawer)& newDr);
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);
98 //! Read excluding state
99 Standard_EXPORT Standard_Boolean IsExcludingOn() const;
101 //! Set presentation manager for builder
102 Standard_EXPORT void SetPresentationManager (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr);
104 //! Get presentation manager of builder
105 Standard_EXPORT Handle(PrsMgr_PresentationManager3d) GetPresentationManager() const;
110 DEFINE_STANDARD_RTTIEXT(MeshVS_PrsBuilder,MMgt_TShared)
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);
125 //! Returns only custom data source
126 Standard_EXPORT Handle(MeshVS_DataSource) DataSource() const;
128 //! Returns only custom drawer
129 Standard_EXPORT Handle(MeshVS_Drawer) Drawer() const;
131 MeshVS_MeshPtr myParentMesh;
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;
154 #endif // _MeshVS_PrsBuilder_HeaderFile