0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / MeshVS / MeshVS_NodalColorPrsBuilder.hxx
CommitLineData
42cf5bc1 1// Created on: 2003-11-12
2// Created by: Alexander SOLOVYOV
3// Copyright (c) 2003-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _MeshVS_NodalColorPrsBuilder_HeaderFile
17#define _MeshVS_NodalColorPrsBuilder_HeaderFile
18
42cf5bc1 19#include <MeshVS_DataMapOfIntegerColor.hxx>
42cf5bc1 20#include <Aspect_SequenceOfColor.hxx>
21#include <TColStd_DataMapOfIntegerReal.hxx>
22#include <Quantity_Color.hxx>
23#include <MeshVS_PrsBuilder.hxx>
24#include <MeshVS_DisplayModeFlags.hxx>
42cf5bc1 25#include <MeshVS_BuilderPriority.hxx>
26#include <TColStd_PackedMapOfInteger.hxx>
42cf5bc1 27#include <MeshVS_HArray1OfSequenceOfInteger.hxx>
28#include <TColStd_Array1OfInteger.hxx>
29#include <TColStd_Array1OfReal.hxx>
7dd7c146 30
42cf5bc1 31class MeshVS_Mesh;
32class MeshVS_DataSource;
42cf5bc1 33class Graphic3d_Texture2D;
34class Graphic3d_ArrayOfPrimitives;
35
42cf5bc1 36DEFINE_STANDARD_HANDLE(MeshVS_NodalColorPrsBuilder, MeshVS_PrsBuilder)
37
38//! This class provides methods to create presentation of nodes with assigned color.
39//! There are two ways of presentation building
40//! 1. Without using texture.
41//! In this case colors of nodes are specified with DataMapOfIntegerColor and presentation
42//! is built with gradient fill between these nodes (default behaviour)
43//! 2. Using texture.
44//! In this case presentation is built with spectrum filling between nodes. For example, if
45//! one node has blue color and second one has violet color, parameters of this class may be
46//! set to fill presentation between nodes with solar spectrum.
47//! Methods:
48//! UseTexture - activates/deactivates this way
49//! SetColorMap - sets colors used for generation of texture
50//! SetColorindices - specifies correspondence between node IDs and indices of colors from color map
51class MeshVS_NodalColorPrsBuilder : public MeshVS_PrsBuilder
52{
53
54public:
55
56
57 Standard_EXPORT MeshVS_NodalColorPrsBuilder(const Handle(MeshVS_Mesh)& Parent, const MeshVS_DisplayModeFlags& Flags = MeshVS_DMF_NodalColorDataPrs, const Handle(MeshVS_DataSource)& DS = 0, const Standard_Integer Id = -1, const MeshVS_BuilderPriority& Priority = MeshVS_BP_NodalColor);
58
59 //! Builds presentation of nodes with assigned color.
79104795 60 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;
42cf5bc1 61
62 //! Returns map of colors assigned to nodes.
63 Standard_EXPORT const MeshVS_DataMapOfIntegerColor& GetColors() const;
64
65 //! Sets map of colors assigned to nodes.
66 Standard_EXPORT void SetColors (const MeshVS_DataMapOfIntegerColor& Map);
67
68 //! Returns true, if map isn't empty
69 Standard_EXPORT Standard_Boolean HasColors() const;
70
71 //! Returns color assigned to single node
72 Standard_EXPORT Standard_Boolean GetColor (const Standard_Integer ID, Quantity_Color& theColor) const;
73
74 //! Sets color assigned to single node
75 Standard_EXPORT void SetColor (const Standard_Integer ID, const Quantity_Color& theColor);
76
77 //! Specify whether texture must be used to build presentation
78 Standard_EXPORT void UseTexture (const Standard_Boolean theToUse);
79
80 //! Verify whether texture is used to build presentation
81 Standard_EXPORT Standard_Boolean IsUseTexture() const;
82
83 //! Set colors to be used for texrture presentation
84 //! theColors - colors for valid coordinates (laying in range [0, 1])
85 Standard_EXPORT void SetColorMap (const Aspect_SequenceOfColor& theColors);
86
87 //! Return colors used for texrture presentation
88 Standard_EXPORT const Aspect_SequenceOfColor& GetColorMap() const;
89
90 //! Set color representing invalid texture coordinate
91 //! (laying outside range [0, 1])
92 Standard_EXPORT void SetInvalidColor (const Quantity_Color& theInvalidColor);
93
94 //! Return color representing invalid texture coordinate
95 //! (laying outside range [0, 1])
96 Standard_EXPORT Quantity_Color GetInvalidColor() const;
97
98 //! Specify correspondence between node IDs and texture coordinates (range [0, 1])
99 Standard_EXPORT void SetTextureCoords (const TColStd_DataMapOfIntegerReal& theMap);
100
101 //! Get correspondence between node IDs and texture coordinates (range [0, 1])
102 Standard_EXPORT const TColStd_DataMapOfIntegerReal& GetTextureCoords() const;
103
104 //! Specify correspondence between node ID and texture coordinate (range [0, 1])
105 Standard_EXPORT void SetTextureCoord (const Standard_Integer theID, const Standard_Real theCoord);
106
107 //! Return correspondence between node IDs and texture coordinate (range [0, 1])
108 Standard_EXPORT Standard_Real GetTextureCoord (const Standard_Integer theID);
109
110 //! Add to array polygons or polylines representing volume
111 Standard_EXPORT void AddVolumePrs (const Handle(MeshVS_HArray1OfSequenceOfInteger)& theTopo, const TColStd_Array1OfInteger& theNodes, const TColStd_Array1OfReal& theCoords, const Handle(Graphic3d_ArrayOfPrimitives)& theArray, const Standard_Boolean theIsShaded, const Standard_Integer theNbColors, const Standard_Integer theNbTexColors, const Standard_Real theColorRatio) const;
112
113
114
115
92efcf78 116 DEFINE_STANDARD_RTTIEXT(MeshVS_NodalColorPrsBuilder,MeshVS_PrsBuilder)
42cf5bc1 117
118protected:
119
120
121
122
123private:
124
125
126 //! Create texture in accordance with myTextureColorMap
127 Standard_EXPORT Handle(Graphic3d_Texture2D) CreateTexture() const;
128
129 MeshVS_DataMapOfIntegerColor myNodeColorMap;
130 Standard_Boolean myUseTexture;
131 Aspect_SequenceOfColor myTextureColorMap;
132 TColStd_DataMapOfIntegerReal myTextureCoords;
133 Quantity_Color myInvalidColor;
134
135
136};
137
138
139
140
141
142
143
144#endif // _MeshVS_NodalColorPrsBuilder_HeaderFile