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 <MeshVS_MeshPtr.hxx>
20 #include <PrsMgr_PresentationManager3d.hxx>
21 #include <Prs3d_Presentation.hxx>
22 #include <MeshVS_DisplayModeFlags.hxx>
23 #include <MeshVS_BuilderPriority.hxx>
24 #include <TColStd_PackedMapOfInteger.hxx>
26 class MeshVS_DataSource;
29 class SelectBasics_SensitiveEntity;
30 class SelectBasics_EntityOwner;
33 class MeshVS_PrsBuilder;
34 DEFINE_STANDARD_HANDLE(MeshVS_PrsBuilder, Standard_Transient)
36 //! This class is parent for all builders using in MeshVS_Mesh.
37 //! It provides base fields and methods all buildes need.
38 class MeshVS_PrsBuilder : public Standard_Transient
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;
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;
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;
63 //! Returns flags, assigned with builder during creation
64 Standard_EXPORT Standard_Integer GetFlags() const;
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;
71 //! Returns builder ID
72 Standard_EXPORT Standard_Integer GetId() const;
74 //! Returns priority; as priority bigger, as soon builder will be called.
75 Standard_EXPORT Standard_Integer GetPriority() const;
77 //! Returns custom data source or default ( from MeshVS_Mesh ) if custom is NULL
78 Standard_EXPORT Handle(MeshVS_DataSource) GetDataSource() const;
80 //! Change custom data source
81 Standard_EXPORT void SetDataSource (const Handle(MeshVS_DataSource)& newDS);
83 //! Returns custom drawer or default ( from MeshVS_Mesh ) if custom is NULL
84 Standard_EXPORT Handle(MeshVS_Drawer) GetDrawer() const;
86 //! Change custom drawer
87 Standard_EXPORT void SetDrawer (const Handle(MeshVS_Drawer)& newDr);
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);
93 //! Read excluding state
94 Standard_EXPORT Standard_Boolean IsExcludingOn() const;
96 //! Set presentation manager for builder
97 Standard_EXPORT void SetPresentationManager (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr);
99 //! Get presentation manager of builder
100 Standard_EXPORT Handle(PrsMgr_PresentationManager3d) GetPresentationManager() const;
105 DEFINE_STANDARD_RTTIEXT(MeshVS_PrsBuilder,Standard_Transient)
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);
120 //! Returns only custom data source
121 Standard_EXPORT Handle(MeshVS_DataSource) DataSource() const;
123 //! Returns only custom drawer
124 Standard_EXPORT Handle(MeshVS_Drawer) Drawer() const;
126 MeshVS_MeshPtr myParentMesh;
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;
149 #endif // _MeshVS_PrsBuilder_HeaderFile