1 // Created on: 2003-11-12
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_ElementalColorPrsBuilder_HeaderFile
17 #define _MeshVS_ElementalColorPrsBuilder_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <MeshVS_DataMapOfIntegerColor.hxx>
23 #include <MeshVS_DataMapOfIntegerTwoColors.hxx>
24 #include <MeshVS_PrsBuilder.hxx>
25 #include <MeshVS_DisplayModeFlags.hxx>
26 #include <Standard_Integer.hxx>
27 #include <MeshVS_BuilderPriority.hxx>
28 #include <TColStd_PackedMapOfInteger.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <MeshVS_TwoColors.hxx>
32 class MeshVS_DataSource;
33 class Prs3d_Presentation;
37 class MeshVS_ElementalColorPrsBuilder;
38 DEFINE_STANDARD_HANDLE(MeshVS_ElementalColorPrsBuilder, MeshVS_PrsBuilder)
40 //! This class provides methods to create presentation of elements with
41 //! assigned colors. The class contains two color maps: map of same colors for front
42 //! and back side of face and map of different ones,
43 class MeshVS_ElementalColorPrsBuilder : public MeshVS_PrsBuilder
50 Standard_EXPORT MeshVS_ElementalColorPrsBuilder(const Handle(MeshVS_Mesh)& Parent, const MeshVS_DisplayModeFlags& Flags = MeshVS_DMF_ElementalColorDataPrs, const Handle(MeshVS_DataSource)& DS = 0, const Standard_Integer Id = -1, const MeshVS_BuilderPriority& Priority = MeshVS_BP_ElemColor);
52 //! Builds presentation of elements with assigned colors.
53 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 Standard_OVERRIDE;
55 //! Returns map of colors same for front and back side of face.
56 Standard_EXPORT const MeshVS_DataMapOfIntegerColor& GetColors1() const;
58 //! Sets map of colors same for front and back side of face.
59 Standard_EXPORT void SetColors1 (const MeshVS_DataMapOfIntegerColor& Map);
61 //! Returns true, if map of colors isn't empty
62 Standard_EXPORT Standard_Boolean HasColors1() const;
64 //! Returns color assigned with element number ID
65 Standard_EXPORT Standard_Boolean GetColor1 (const Standard_Integer ID, Quantity_Color& theColor) const;
67 //! Sets color assigned with element number ID
68 Standard_EXPORT void SetColor1 (const Standard_Integer ID, const Quantity_Color& theColor);
70 //! Returns map of different colors for front and back side of face
71 Standard_EXPORT const MeshVS_DataMapOfIntegerTwoColors& GetColors2() const;
73 //! Sets map of different colors for front and back side of face
74 Standard_EXPORT void SetColors2 (const MeshVS_DataMapOfIntegerTwoColors& Map);
76 //! Returns true, if map isn't empty
77 Standard_EXPORT Standard_Boolean HasColors2() const;
79 //! Returns colors assigned with element number ID
80 Standard_EXPORT Standard_Boolean GetColor2 (const Standard_Integer ID, MeshVS_TwoColors& theColor) const;
82 //! Returns colors assigned with element number ID
83 //! theColor1 is the front element color
84 //! theColor2 is the back element color
85 Standard_EXPORT Standard_Boolean GetColor2 (const Standard_Integer ID, Quantity_Color& theColor1, Quantity_Color& theColor2) const;
87 //! Sets colors assigned with element number ID
88 Standard_EXPORT void SetColor2 (const Standard_Integer ID, const MeshVS_TwoColors& theTwoColors);
90 //! Sets color assigned with element number ID
91 //! theColor1 is the front element color
92 //! theColor2 is the back element color
93 Standard_EXPORT void SetColor2 (const Standard_Integer ID, const Quantity_Color& theColor1, const Quantity_Color& theColor2);
98 DEFINE_STANDARD_RTTIEXT(MeshVS_ElementalColorPrsBuilder,MeshVS_PrsBuilder)
108 MeshVS_DataMapOfIntegerColor myElemColorMap1;
109 MeshVS_DataMapOfIntegerTwoColors myElemColorMap2;
120 #endif // _MeshVS_ElementalColorPrsBuilder_HeaderFile