Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:18:16

0001 // Created on: 2003-11-12
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_ElementalColorPrsBuilder_HeaderFile
0017 #define _MeshVS_ElementalColorPrsBuilder_HeaderFile
0018 
0019 #include <Standard_Integer.hxx>
0020 #include <Quantity_Color.hxx>
0021 #include <NCollection_DataMap.hxx>
0022 #include <MeshVS_TwoColors.hxx>
0023 #include <MeshVS_PrsBuilder.hxx>
0024 #include <MeshVS_DisplayModeFlags.hxx>
0025 #include <MeshVS_BuilderPriority.hxx>
0026 
0027 class MeshVS_Mesh;
0028 class MeshVS_DataSource;
0029 class Quantity_Color;
0030 
0031 //! This class provides methods to create presentation of elements with
0032 //! assigned colors. The class contains two color maps: map of same colors for front
0033 //! and back side of face and map of different ones,
0034 class MeshVS_ElementalColorPrsBuilder : public MeshVS_PrsBuilder
0035 {
0036 
0037 public:
0038   //! Constructor
0039   Standard_EXPORT MeshVS_ElementalColorPrsBuilder(
0040     const occ::handle<MeshVS_Mesh>&       Parent,
0041     const MeshVS_DisplayModeFlags&        Flags    = MeshVS_DMF_ElementalColorDataPrs,
0042     const occ::handle<MeshVS_DataSource>& DS       = nullptr,
0043     const int                             Id       = -1,
0044     const MeshVS_BuilderPriority&         Priority = MeshVS_BP_ElemColor);
0045 
0046   //! Builds presentation of elements with assigned colors.
0047   Standard_EXPORT void Build(const occ::handle<Prs3d_Presentation>& Prs,
0048                              const TColStd_PackedMapOfInteger&      IDs,
0049                              TColStd_PackedMapOfInteger&            IDsToExclude,
0050                              const bool                             IsElement,
0051                              const int                              DisplayMode) const override;
0052 
0053   //! Returns map of colors same for front and back side of face.
0054   Standard_EXPORT const NCollection_DataMap<int, Quantity_Color>& GetColors1() const;
0055 
0056   //! Sets map of colors same for front and back side of face.
0057   Standard_EXPORT void SetColors1(const NCollection_DataMap<int, Quantity_Color>& Map);
0058 
0059   //! Returns true, if map of colors isn't empty
0060   Standard_EXPORT bool HasColors1() const;
0061 
0062   //! Returns color assigned with element number ID
0063   Standard_EXPORT bool GetColor1(const int ID, Quantity_Color& theColor) const;
0064 
0065   //! Sets color assigned with element number ID
0066   Standard_EXPORT void SetColor1(const int ID, const Quantity_Color& theColor);
0067 
0068   //! Returns map of different colors for front and back side of face
0069   Standard_EXPORT const NCollection_DataMap<int, MeshVS_TwoColors>& GetColors2() const;
0070 
0071   //! Sets map of different colors for front and back side of face
0072   Standard_EXPORT void SetColors2(const NCollection_DataMap<int, MeshVS_TwoColors>& Map);
0073 
0074   //! Returns true, if map isn't empty
0075   Standard_EXPORT bool HasColors2() const;
0076 
0077   //! Returns colors assigned with element number ID
0078   Standard_EXPORT bool GetColor2(const int ID, MeshVS_TwoColors& theColor) const;
0079 
0080   //! Returns colors assigned with element number ID
0081   //! theColor1 is the front element color
0082   //! theColor2 is the back element color
0083   Standard_EXPORT bool GetColor2(const int       ID,
0084                                  Quantity_Color& theColor1,
0085                                  Quantity_Color& theColor2) const;
0086 
0087   //! Sets colors assigned with element number ID
0088   Standard_EXPORT void SetColor2(const int ID, const MeshVS_TwoColors& theTwoColors);
0089 
0090   //! Sets color assigned with element number ID
0091   //! theColor1 is the front element color
0092   //! theColor2 is the back element color
0093   Standard_EXPORT void SetColor2(const int             ID,
0094                                  const Quantity_Color& theColor1,
0095                                  const Quantity_Color& theColor2);
0096 
0097   DEFINE_STANDARD_RTTIEXT(MeshVS_ElementalColorPrsBuilder, MeshVS_PrsBuilder)
0098 
0099 private:
0100   NCollection_DataMap<int, Quantity_Color>   myElemColorMap1;
0101   NCollection_DataMap<int, MeshVS_TwoColors> myElemColorMap2;
0102 };
0103 
0104 #endif // _MeshVS_ElementalColorPrsBuilder_HeaderFile