b311480e |
1 | -- Created on: 2003-11-12 |
2 | -- Created by: Alexander SOLOVYOV |
973c2be1 |
3 | -- Copyright (c) 2003-2014 OPEN CASCADE SAS |
b311480e |
4 | -- |
973c2be1 |
5 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
6 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | -- |
973c2be1 |
13 | -- Alternatively, this file may be used under the terms of Open CASCADE |
14 | -- commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | class NodalColorPrsBuilder from MeshVS inherits PrsBuilder from MeshVS |
17 | |
18 | ---Purpose: This class provides methods to create presentation of nodes with assigned color. |
19 | -- There are two ways of presentation building |
20 | -- 1. Without using texture. |
21 | -- In this case colors of nodes are specified with DataMapOfIntegerColor and presentation |
22 | -- is built with gradient fill between these nodes (default behaviour) |
23 | -- 2. Using texture. |
24 | -- In this case presentation is built with spectrum filling between nodes. For example, if |
25 | -- one node has blue color and second one has violet color, parameters of this class may be |
26 | -- set to fill presentation between nodes with solar spectrum. |
27 | -- Methods: |
28 | -- UseTexture - activates/deactivates this way |
29 | -- SetColorMap - sets colors used for generation of texture |
30 | -- SetColorindices - specifies correspondence between node IDs and indices of colors from color map |
31 | |
32 | uses |
33 | Presentation from Prs3d, |
34 | |
35 | Boolean from Standard, |
36 | Integer from Standard, |
37 | |
37ac4a67 |
38 | DisplayModeFlags from MeshVS, |
39 | Mesh from MeshVS, |
40 | MeshPtr from MeshVS, |
41 | DataSource from MeshVS, |
42 | DataMapOfIntegerColor from MeshVS, |
43 | BuilderPriority from MeshVS, |
44 | HArray1OfSequenceOfInteger from MeshVS, |
45 | SequenceOfColor from Aspect, |
46 | Color from Quantity, |
47 | Texture2D from Graphic3d, |
48 | ArrayOfPrimitives from Graphic3d, |
49 | DataMapOfIntegerReal from TColStd, |
50 | PackedMapOfInteger from TColStd, |
51 | Array1OfInteger from TColStd, |
52 | Array1OfReal from TColStd |
7fd59977 |
53 | |
54 | is |
55 | |
56 | Create ( Parent : Mesh from MeshVS; |
57 | Flags : DisplayModeFlags from MeshVS = MeshVS_DMF_NodalColorDataPrs; |
58 | DS : DataSource from MeshVS = 0; |
59 | Id : Integer = -1; |
60 | Priority : BuilderPriority from MeshVS = MeshVS_BP_NodalColor ) |
6e33d3ce |
61 | returns NodalColorPrsBuilder from MeshVS; |
7fd59977 |
62 | |
63 | Build ( me; Prs : Presentation from Prs3d; |
64 | IDs : PackedMapOfInteger; |
65 | IDsToExclude : in out PackedMapOfInteger; |
66 | IsElement : Boolean; |
67 | DisplayMode : Integer ) is virtual; |
68 | ---Purpose: Builds presentation of nodes with assigned color. |
69 | |
70 | |
71 | GetColors ( me ) returns DataMapOfIntegerColor from MeshVS; |
72 | ---C++: return const & |
73 | ---Purpose: Returns map of colors assigned to nodes. |
74 | |
75 | SetColors ( me : mutable; |
76 | Map : DataMapOfIntegerColor from MeshVS ); |
77 | ---Purpose: Sets map of colors assigned to nodes. |
78 | |
79 | HasColors ( me ) returns Boolean; |
80 | ---Purpose: Returns true, if map isn't empty |
81 | |
82 | GetColor ( me; ID : Integer; |
83 | theColor : out Color from Quantity ) returns Boolean; |
84 | ---Purpose: Returns color assigned to single node |
85 | |
86 | SetColor ( me : mutable; |
87 | ID : Integer; |
88 | theColor : Color from Quantity ); |
89 | ---Purpose: Sets color assigned to single node |
90 | |
91 | UseTexture ( me : mutable; theToUse : Boolean ); |
92 | ---Purpose: Specify whether texture must be used to build presentation |
93 | |
94 | IsUseTexture( me ) returns Boolean; |
95 | ---Purpose: Verify whether texture is used to build presentation |
96 | |
97 | SetColorMap ( me : mutable; theColors : SequenceOfColor from Aspect ); |
98 | ---Purpose: Set colors to be used for texrture presentation |
99 | --- theColors - colors for valid coordinates (laying in range [0, 1]) |
100 | |
101 | GetColorMap ( me ) returns SequenceOfColor from Aspect; |
102 | ---C++: return const & |
103 | ---Purpose: Return colors used for texrture presentation |
104 | |
105 | SetInvalidColor ( me : mutable; theInvalidColor : Color from Quantity ); |
106 | ---Purpose: Set color representing invalid texture coordinate |
107 | --- (laying outside range [0, 1]) |
108 | |
109 | GetInvalidColor ( me ) returns Color from Quantity; |
110 | ---Purpose: Return color representing invalid texture coordinate |
111 | --- (laying outside range [0, 1]) |
112 | |
113 | SetTextureCoords ( me : mutable; theMap : DataMapOfIntegerReal from TColStd ); |
114 | ---Purpose: Specify correspondence between node IDs and texture coordinates (range [0, 1]) |
115 | |
116 | GetTextureCoords ( me ) returns DataMapOfIntegerReal from TColStd; |
117 | ---C++: return const & |
118 | ---Purpose: Get correspondence between node IDs and texture coordinates (range [0, 1]) |
119 | |
120 | SetTextureCoord ( me : mutable; theID : Integer; theCoord : Real ); |
121 | ---Purpose: Specify correspondence between node ID and texture coordinate (range [0, 1]) |
122 | |
123 | GetTextureCoord ( me : mutable; theID : Integer) returns Real; |
124 | ---Purpose: Return correspondence between node IDs and texture coordinate (range [0, 1]) |
125 | |
126 | CreateTexture ( me ) returns Texture2D from Graphic3d |
127 | ---Purpose: Create texture in accordance with myTextureColorMap |
128 | is static private; |
129 | |
37ac4a67 |
130 | AddVolumePrs ( me; |
131 | theTopo : HArray1OfSequenceOfInteger from MeshVS; |
132 | theNodes : Array1OfInteger from TColStd; |
133 | theCoords : Array1OfReal from TColStd; |
134 | theArray : ArrayOfPrimitives from Graphic3d; |
135 | theIsShaded : Boolean; |
136 | theNbColors : Integer; |
137 | theNbTexColors : Integer; |
138 | theColorRatio : Real ); |
139 | ---Purpose: Add to array polygons or polylines representing volume |
7fd59977 |
140 | |
141 | fields |
142 | myNodeColorMap : DataMapOfIntegerColor from MeshVS; |
143 | myUseTexture : Boolean from Standard; |
144 | myTextureColorMap : SequenceOfColor from Aspect; |
145 | myTextureCoords : DataMapOfIntegerReal from TColStd; |
146 | myInvalidColor : Color from Quantity; |
147 | |
148 | end NodalColorPrsBuilder; |