Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
PoAutoValueLegend.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-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PO_AUTO_VALUE_LEGEND_
25#define _PO_AUTO_VALUE_LEGEND_
26
27#include <MeshViz/graph/PoValueLegend.h>
28
29#include <Inventor/fields/SoSFVec2f.h>
30
48
49 SO_KIT_HEADER(PoAutoValueLegend) ;
50
51
52 public:
53
54 /* Fields */
55
64
69
70 /*----------------------------------------------------------------------------*/
71 private:
72 static void initClass() ;
73 static void exitClass() ;
74
75 private:
76 // Constructor
78 { init(SbVec2f(0., 0.), SbVec2f(1., 1.)) ; }
79
80 PoAutoValueLegend(const SbVec2f &_start, const SbVec2f &_end)
81 { init(_start, _end) ; }
82
83 // Methods
84 virtual void setDefaultOnNonWritingFields() ;
85 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
86
87 // Destructor
88 virtual ~PoAutoValueLegend() ;
89
90 // Draw multiplicative factor
91 void drawMultFactor(MultFactorPosition position, Plimit &limit) ;
92
93 /*********** Methods for legend constitued of several boxes ****************/
94
95 // Compute strings font size
96 void computeStrFtSizeLegendBoxes(float legend_width, float legend_height, int nb_lines,
97 int nb_columns, float f0, float *maxTextSizePerCol,
98 SbVec2f &space_box) ;
99
100 // Compute graphic size use to draw values in auto legend constitued
101 // of several boxes
102 void computeGraphicSizeForValues(float &width, float &height, float &text_space) ;
103
104 // Draw the legend
105 void drawBoxesLegend(int numStrings, const SbString *strings) ;
106
107 // Draw a box with an interior colors computed though BoxRepresentation
108 void drawBoxLegendBoxesA(SoGroup *boxBorderGroup, SoGroup *boxGroup,
109 const SbVec2f &topLeftCorner, float width, float height,
110 int repIndex) ;
111
112 /************ Methods for legend constitued of one box *********************/
113
114 enum ValDistrib {
115 ALL_VAL,
116 LINEAR_VAL,
117 MIN_MAX_VAL
118 } ;
119
120 // Draw the legend
121 void drawOneBoxLegend(ValDistrib val_distrib, SbBool isLinear, SbBool isLowerUpperBoxes) ;
122
123 // Compute size for undef boxes (if they exists) and
124 // update size of the legend
125 void computeUndefBoxOneBoxLegend(float &legend_width, float &legend_height,
126 float &undef_box_width, float &undef_box_height,
127 float &undef_box_space) ;
128
129 // Draw rectangle which represents values
130 void drawValuesRectOneBoxLegend(float val_rect_height, float val_rect_width,
131 int lower_undef_index, const float *val_rect_dist,
132 const Plimit &limit) ;
133
134 // Draw undefined boxes and associated texts
135 void drawUndefBoxesOneBoxLegend(float text_offset, float undef_box_height,
136 float undef_box_width, float undef_box_space,
137 int lower_undef_index, int upper_undef_index,
138 Plimit &limit) ;
139
140 // Draw values text
141 void drawValuesOneBoxLegend(float val_rect_width, float val_rect_height,
142 float text_offset, const float *val_dist,
143 SbString *val_str, int num_val, const Plimit &limit) ;
144
145 // Compute font size of values
146 void computeValFtSizeOneBoxLegend(ValDistrib val_distrib, float legend_width, float legend_height,
147 int lower_undef_index, int upper_undef_index,
148 float undef_box_width, float undef_box_height,
149 const float *val_rect_dist, int &num_val_to_display,
150 SbString **val_str, float **val_dist, float &val_width,
151 float &val_height) ;
152
153 float m_maxValueSize ;
154
155 private:
156 // Init Method
157 void init(const SbVec2f &_start, const SbVec2f &_end) ;
158
159 // Sensors
160 FieldSensorList m_fieldSensorList ;
161
162 // List of fields defined in this class
163 SoFieldList m_fieldList ;
164
165 // Indicates if a lower box and a upper box should be drawn.
166 SbBool m_isLowerUpperBoxes ;
167} ;
168
169/*----------------------------------------------------------------------------*/
170
171#endif /* _PO_AUTO_VALUE_LEGEND_ */
172
173
174
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for autom...
SoSFVec2f start
First point of one of the diagonals of the rectangle delimiting the legend.
SoSFVec2f end
Second point of the same diagonal.
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for value...
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:76
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Base class for all group nodes.
Definition SoGroup.h:122
Field containing a two-dimensional vector.
Definition SoSFVec2f.h:78
int SbBool
Boolean type.
Definition SbBase.h:87