Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:16

0001 // Created on: 2003-10-10
0002 // Created by: Alexander SOLOVYOV
0003 // Copyright (c) 2003-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _MeshVS_PrsBuilder_HeaderFile
0017 #define _MeshVS_PrsBuilder_HeaderFile
0018 
0019 #include <MeshVS_MeshPtr.hxx>
0020 #include <PrsMgr_PresentationManager.hxx>
0021 #include <Prs3d_Presentation.hxx>
0022 #include <MeshVS_DisplayModeFlags.hxx>
0023 #include <MeshVS_BuilderPriority.hxx>
0024 #include <TColStd_PackedMapOfInteger.hxx>
0025 
0026 class MeshVS_DataSource;
0027 class MeshVS_Drawer;
0028 class MeshVS_Mesh;
0029 class Select3D_SensitiveEntity;
0030 class SelectMgr_EntityOwner;
0031 
0032 DEFINE_STANDARD_HANDLE(MeshVS_PrsBuilder, Standard_Transient)
0033 
0034 //! This class is parent for all builders using in MeshVS_Mesh.
0035 //! It provides base fields and methods all buildes need.
0036 class MeshVS_PrsBuilder : public Standard_Transient
0037 {
0038 public:
0039 
0040   //! Builds presentation of certain type of data.
0041   //! Prs is presentation object which this method constructs.
0042   //! IDs is set of numeric identificators forming object appearance.
0043   //! IDsToExclude is set of IDs to exclude from processing. If some entity
0044   //! has been excluded, it is not processed by other builders.
0045   //! IsElement indicates, IDs is identificators of nodes or elements.
0046   //! DisplayMode is numeric constant describing display mode (see MeshVS_DisplayModeFlags.hxx)
0047   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;
0048   
0049   //! This method is called to build presentation of custom elements (they have MeshVS_ET_0D type).
0050   //! IDs is set of numeric identificators of elements for custom building.
0051   //! IDsToExclude is set of IDs to exclude from processing. If some entity
0052   //! has been excluded, it is not processed by other builders.
0053   //! DisplayMode is numeric constant describing display mode (see MeshVS_DisplayModeFlags.hxx)
0054   Standard_EXPORT virtual void CustomBuild (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Integer DisplayMode) const;
0055   
0056   //! This method is called to build sensitive of custom elements ( they have MeshVS_ET_0D type )
0057   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) CustomSensitiveEntity (const Handle(SelectMgr_EntityOwner)& Owner, const Standard_Integer SelectMode) const;
0058   
0059   //! Returns flags, assigned with builder during creation
0060   Standard_EXPORT Standard_Integer GetFlags() const;
0061   
0062   //! Test whether display mode has flags assigned with this builder.
0063   //! This method has default implementation and can be redefined for advance behavior
0064   //! Returns Standard_True only if display mode is appropriate for this builder
0065   Standard_EXPORT virtual Standard_Boolean TestFlags (const Standard_Integer DisplayMode) const;
0066   
0067   //! Returns builder ID
0068   Standard_EXPORT Standard_Integer GetId() const;
0069   
0070   //! Returns priority; as priority bigger, as soon builder will be called.
0071   Standard_EXPORT Standard_Integer GetPriority() const;
0072   
0073   //! Returns custom data source or default ( from MeshVS_Mesh ) if custom is NULL
0074   Standard_EXPORT Handle(MeshVS_DataSource) GetDataSource() const;
0075   
0076   //! Change custom data source
0077   Standard_EXPORT void SetDataSource (const Handle(MeshVS_DataSource)& newDS);
0078   
0079   //! Returns custom drawer or default ( from MeshVS_Mesh ) if custom is NULL
0080   Standard_EXPORT Handle(MeshVS_Drawer) GetDrawer() const;
0081   
0082   //! Change custom drawer
0083   Standard_EXPORT void SetDrawer (const Handle(MeshVS_Drawer)& newDr);
0084   
0085   //! Set excluding state. If it is Standard_True, the nodes or elements, processed by current builder
0086   //! will be noted and next builder won't process its.
0087   Standard_EXPORT void SetExcluding (const Standard_Boolean state);
0088   
0089   //! Read excluding state
0090   Standard_EXPORT Standard_Boolean IsExcludingOn() const;
0091 
0092   //! Set presentation manager for builder
0093   Standard_EXPORT void SetPresentationManager (const Handle(PrsMgr_PresentationManager)& thePrsMgr);
0094 
0095   //! Get presentation manager of builder
0096   Standard_EXPORT Handle(PrsMgr_PresentationManager) GetPresentationManager() const;
0097 
0098   DEFINE_STANDARD_RTTIEXT(MeshVS_PrsBuilder,Standard_Transient)
0099 
0100 protected:
0101 
0102   //! Constructor
0103   //! Parent is pointer to MeshVS_Mesh object
0104   //! Flags is set of display modes corresponding to this builder
0105   //! DS is data source object, from which builder will pick geometry and topological information
0106   //! Id is numeric identificator of builder. You must set it to positive integer, but if
0107   //! you set it to -1, constructor will select the smallest integer, not occupied by other builders
0108   //! Priority is numerical priority constant. As priority bigger, as sooner builder starts during
0109   //! presentation construction
0110   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);
0111   
0112   //! Returns only custom data source
0113   Standard_EXPORT Handle(MeshVS_DataSource) DataSource() const;
0114   
0115   //! Returns only custom drawer
0116   Standard_EXPORT Handle(MeshVS_Drawer) Drawer() const;
0117 
0118 protected:
0119 
0120   MeshVS_MeshPtr myParentMesh;
0121 
0122 private:
0123 
0124   Standard_Boolean myIsExcluding;
0125   Handle(MeshVS_DataSource) myDataSource;
0126   Handle(MeshVS_Drawer) myDrawer;
0127   Standard_Integer myFlags;
0128   Standard_Integer myId;
0129   Standard_Integer myPriority;
0130   Handle(PrsMgr_PresentationManager) myPrsMgr;
0131 
0132 };
0133 
0134 #endif // _MeshVS_PrsBuilder_HeaderFile