Open Inventor Release 2024.1.2
 
Loading...
Searching...
No Matches
MoLegend.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2021 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#ifndef _MoLegend_
24#define _MoLegend_
25
26#include <MeshVizXLM/mapping/nodes/MoMeshBaseRepresentation.h>
27#include <MeshVizXLM/mapping/interfaces/MiColorMapping.h>
28
29#include <MeshVizXLM/MbVec3.h>
30
31#include <Inventor/misc/SoRef.h>
32#include <Inventor/caches/SoCache.h>
33#include <Inventor/fields/SoSFDouble.h>
34#include <Inventor/fields/SoSFVec2f.h>
35#include <Inventor/fields/SoSFUInt32.h>
36
37#ifdef _WIN32
38#pragma warning(push)
39#pragma warning(disable:4251)
40#endif
41
42class SoState;
43class SbColorRGBA;
44class MdSurfaceMeshRectilinear;
45
46class MxScalarSetIj;
47class MdSurfaceMesh;
48class MdLevelColorMapping;
49class MdLinearColorMapping;
50class MdPredefinedColorMapping;
51
52
91class MESHVIZXLM_DMAP_API MoLegend : public MoMeshBaseRepresentation {
92
93 SO_NODE_HEADER(MoLegend) ;
94
95public:
96
101
107
113
120
127
133
138
143
148
158
164
171
172
179
184
189
193 enum Notation {
196 NOTATION_SCIENTIFIC
197 };
198
209
230
231 /*----------------------------------------------------------------------------*/
232 private:
233 virtual void doAction(SoAction *action);
234
235 private:
236 static void initClass() ;
237 static void exitClass() ;
238
239private:
240 virtual ~MoLegend() ;
241
242 void fillLegend(SoState* state);
243 void fillLevelCM(SoState* state, const MdLevelColorMapping& levelCM);
244 void fillLinearCM(SoState* state, const MdLinearColorMapping& linearCM);
245 void fillPredefCM(SoState* state, const MdPredefinedColorMapping& predefCM);
246 void fillCustomCM(SoState* state, const MiColorMapping<double,SbColorRGBA>& customCM);
247 void createMesh(SoState* state, int ind, std::vector<float>& coords0, std::vector<float> coords1, float xmin, float xmax, double vmin, double vmax);
248 void getLegendRange(const MiColorMapping<double, SbColorRGBA>& cmap,double& vmin,double& vmax);
249
250 void drawTitle(SoState* state);
251 void drawValues(SoState* state,double vmin, double vmax);
252
253 void clear();
254
255 MdSurfaceMesh* m_surface;
256 SoSeparator* m_textGroup;
257 SoSeparator* m_valuesGroup;
258 MdSurfaceMeshRectilinear* m_legendMesh;
259 MxScalarSetIj* m_scalarSet;
260private:
262 SoRef<SoCache> m_cache;
263 void buildCache( SoState *state );
264 SbBool checkCache( SoState *state );
265} ;
266
267#ifdef _WIN32
268#pragma warning(pop)
269#endif
270
271#endif /* _MoLegend_ */
272
273
274
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Interface class defining...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Rendering node that disp...
Definition MoLegend.h:91
SoSFString title
The title of the legend.
Definition MoLegend.h:137
SoSFBool vertical
If TRUE, the legend is vertical.
Definition MoLegend.h:132
SoSFEnum valueNotation
Defines the notation type (fixed or scientific) used to display the values of this legend.
Definition MoLegend.h:208
SoSFColor titleColor
Color for the title of the legend.
Definition MoLegend.h:147
SoSFVec2f bottomLeft
Bottom left corner of the rectangle in which the legend will be drawn.
Definition MoLegend.h:106
SoSFDouble minValue
The minimum value defining the range of data to display in the legend.
Definition MoLegend.h:119
SoSFFloat titleFontSize
The size of the font for the title of the legend.
Definition MoLegend.h:142
SoSFBool displayValues
If TRUE, display numValues values starting from the minimal to the maximal values of the colormap.
Definition MoLegend.h:170
SoSFVec2f topRight
Top-right corner of the rectangle in which the legend will be drawn.
Definition MoLegend.h:112
SoSFEnum titlePosition
The position of the title relative to the legend box.
Definition MoLegend.h:163
SoSFUInt32 valuePrecision
Defines the maximum number of significant digits to display, or the maximum number of digits after th...
Definition MoLegend.h:229
MoLegend()
Constructor.
SoSFInt32 numValues
The number of values displayed near the colorbar.
Definition MoLegend.h:178
SoSFDouble maxValue
The maximum value defining the range of data to display in the legend.
Definition MoLegend.h:126
Position
Position of the title.
Definition MoLegend.h:152
@ POS_BOTTOM
Bottom.
Definition MoLegend.h:153
@ POS_TOP
Top.
Definition MoLegend.h:154
@ POS_RIGHT
Right.
Definition MoLegend.h:155
SoSFColor valuesColor
Color for the values of the legend.
Definition MoLegend.h:183
SoSFFloat valuesFontSize
The size of the font for the values of the legend.
Definition MoLegend.h:188
Notation
Notation type of the values.
Definition MoLegend.h:193
@ NOTATION_FIXED
Definition MoLegend.h:195
@ NOTATION_DEFAULT
Definition MoLegend.h:194
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract base class for ...
ColorRGBA vector class.
Definition SbColorRGBA.h:61
Abstract base class for all actions.
Definition SoAction.h:132
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an RGB color.
Definition SoSFColor.h:82
Field containing a floating-point value.
Definition SoSFDouble.h:53
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a string.
Definition SoSFString.h:117
Field containing an unsigned int32_t integer.
Definition SoSFUInt32.h:80
Field containing a two-dimensional vector.
Definition SoSFVec2f.h:78
Group node that saves and restores traversal state.
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87