Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
PoItemLegend.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_ITEM_LEGEND_
25#define _PO_ITEM_LEGEND_
26
27#include <MeshViz/graph/PoLegend.h>
28
29#include <Inventor/fields/SoSFVec2f.h>
30#include <Inventor/fields/SoSFBool.h>
31#include <Inventor/fields/SoMFString.h>
32#include <Inventor/fields/SoMFColor.h>
33#include <Inventor/fields/SoMFUShort.h>
34#include <Inventor/fields/SoMFFloat.h>
35
36class PiText ;
37
94class PoItemLegend : public PoLegend {
95
96 SO_KIT_HEADER(PoItemLegend) ;
97
98 /* Define fields for new parts */
99 SO_KIT_CATALOG_ENTRY_HEADER(lineSep) ;
100 SO_KIT_CATALOG_ENTRY_HEADER(lineApp) ;
101 SO_KIT_CATALOG_ENTRY_HEADER(line) ;
102
103 SO_KIT_CATALOG_ENTRY_HEADER(markerSep) ;
104 SO_KIT_CATALOG_ENTRY_HEADER(markerApp) ;
105 SO_KIT_CATALOG_ENTRY_HEADER(marker) ;
106
107
108 public:
109
110 /* Fields */
111
116
121
126
127
128
133
140
141
142
147
152
157
164
165
166
171
179
187
198
199
200
201 /* Methods */
202
207 { init(TRUE, SbVec2f(0.,0.), SbVec2f(1.,1.), 0, NULL, NULL) ; }
208
213 PoItemLegend(const SbVec2f &_start, const SbVec2f &_end, int _numItems,
214 const char** _item, const SbColor *_boxColor=NULL)
215 { init(FALSE, _start, _end, _numItems, _item, _boxColor) ; }
216
220 virtual void rebuild() ;
221
222 /*----------------------------------------------------------------------------*/
223
224
225 private:
226 static void initClass() ;
227 static void exitClass() ;
228
229 private:
230 // Methods
231 virtual void setDefaultOnNonWritingFields() ;
232 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
233
234 // Destructor
235 virtual ~PoItemLegend() ;
236
237 // Determines if the legend must be reverted or not.
238 virtual void setRevertOrder(float startY, float endY)
239 { m_revertOrder = (startY <= endY ? TRUE : FALSE) ; }
240
241 private:
242 // Init method
243 void init(SbBool isDefault, const SbVec2f &_start, const SbVec2f &_end,
244 int _numItems, const char** _item, const SbColor *_boxColor) ;
245
246 // Compute items font size
247 void computeItemFontSize(float legend_width, float legend_height, int nb_lines,
248 int nb_columns, float f0, float *maxTextSizePerCol,
249 SbVec2f &space_box) ;
250
251 // Draw a box with an interior color
252 void drawBoxLegendBoxesA(SoGroup *boxBorderGroup, SoGroup *boxGroup,
253 const SbVec2f &topLeftCorner, float width, float height,
254 int repIndex) ;
255
256 // Draw lines
257 void drawLines(int nb_lines, int nb_columns, int numItems,
258 const float *maxTextSizePerCol, const SbVec2f &space_box,
259 const Plimit &current_limit) ;
260
261 // Draw a horizontal line with color, pattern and size
262 void drawHorLine(SoGroup *lineGroup, const SbVec2f &orig, float size,
263 SbBool isColor, SbBool isSize, SbBool isPattern, int repIndex) ;
264
265 // Draw markers
266 void drawMarkers(int nb_lines, int nb_columns, int numItems,
267 const float *maxTextSizePerCol, const SbVec2f &space_box,
268 const Plimit &current_limit) ;
269
270 // Draw a marker with color, type and size
271 void drawMarker(SoGroup *markerGroup, const SbVec2f &orig, SbBool isColor,
272 SbBool isSize, SbBool isType, int repIndex) ;
273
274 // Compute graphic size use to draw values in auto legend constitued
275 // of several boxes
276 void computeGraphicSizeForValues(float &width, float &height,
277 float &text_space) ;
278
279 // Sensors
280 FieldSensorList m_fieldSensorList ;
281
282 // List of fields defined in this class
283 SoFieldList m_fieldList ;
284} ;
285
286/*----------------------------------------------------------------------------*/
287
288#endif /* _PO_ITEM_LEGEND_ */
289
290
291
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to build an items ...
PoItemLegend()
Default constructor.
SoMFFloat lineSize
List of sizes for lines.
SoMFString item
List of item names.
SoMFUShort linePattern
Be careful: (lineColor or lineSize or linePattern).getNum() must be greater or equal to item....
SoMFColor markerColor
List of color for markers.
SoSFBool boxVisibility
Visibility of the boxes.
SoSFVec2f start
First point of one of the diagonals of the rectangle delimiting the legend.
SoMFFloat markerSize
List of sizes for markers.
SoMFColor lineColor
List of colors for lines.
SoSFBool lineVisibility
Visibility of the lines.
SoMFColor boxColor
List of colors for the boxes (boxColor.getNum() must be greater or equal to item.getNum(),...
virtual void rebuild()
Forces node-kit rebuilding.
SoSFVec2f end
Second point of the same diagonal.
SoSFBool markerVisibility
Visibility of the markers.
PoItemLegend(const SbVec2f &_start, const SbVec2f &_end, int _numItems, const char **_item, const SbColor *_boxColor=NULL)
Constructor.
SoMFString markerString
The markers are defined by a list of strings.
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for legen...
Definition PoLegend.h:55
Color vector class.
Definition SbColor.h:82
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
Multiple-value field containing any number of RGB colors stored as three floats.
Definition SoMFColor.h:98
Multiple-value field containing any number of floating point values.
Definition SoMFFloat.h:90
Multiple-value field containing any number of strings.
Definition SoMFString.h:116
Multiple-value field containing any number of unsigned short integers.
Definition SoMFUShort.h:89
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a two-dimensional vector.
Definition SoSFVec2f.h:78
int SbBool
Boolean type.
Definition SbBase.h:87