Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
PoPieChartRep.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_PIE_CHART_REP_
25#define _PO_PIE_CHART_REP_
26
27#include <MeshViz/graph/PoChart.h>
28
29#include <Inventor/fields/SoSFBool.h>
30#include <Inventor/fields/SoSFFloat.h>
31#include <Inventor/fields/SoMFFloat.h>
32#include <Inventor/fields/SoMFShort.h>
33#include <Inventor/fields/SoSFString.h>
34
35class SoTranslation ;
36class PbMesh1D ;
37
100class PoPieChartRep : public PoChart {
101
102 SO_KIT_HEADER(PoPieChartRep) ;
103
104 /* Define fields for new parts */
105 SO_KIT_CATALOG_ENTRY_HEADER(sliceSep) ;
106 SO_KIT_CATALOG_ENTRY_HEADER(sliceApp) ;
107 SO_KIT_CATALOG_ENTRY_HEADER(slice) ;
108
109 SO_KIT_CATALOG_ENTRY_HEADER(annotationSep) ;
110 SO_KIT_CATALOG_ENTRY_HEADER(annotationApp) ;
111 SO_KIT_CATALOG_ENTRY_HEADER(annotation) ;
112
113 SO_KIT_CATALOG_ENTRY_HEADER(annotationLineSep) ;
114 SO_KIT_CATALOG_ENTRY_HEADER(annotationLineApp) ;
115 SO_KIT_CATALOG_ENTRY_HEADER(annotationLine) ;
116
117
118 public:
119
120 /* Fields */
121
128
134
139
145
152
158
165
170
175
181
187
192
197
202
211 SbBool getPickedSliceNumber(const SoPath *path, int &sliceNumber) const ;
212
223 void setSliceToTranslate(int sliceNumber, float radius) ;
224
230 float getSliceToTranslate(int sliceNumber) const ;
231
232 /*----------------------------------------------------------------------------*/
233
234
235 private:
236 static void initClass() ;
237 static void exitClass() ;
238
239 private:
240 struct SliceAttr {
241 float startAngle ;
242 float endAngle ;
243 float value ;
244 float height ;
245 SbString nameStr ;
246 SbString percentageStr ;
247 SbString valueStr ;
248 SoMaterial *material ;
249 SoTranslation *translation ;
250 } ;
251
252 virtual ~PoPieChartRep() ;
253 // Destructor.
254
255 // Overloaded methods
256 virtual void rebuild() ;
257 virtual void addElementsAllCaches() ;
258 virtual void preRebuild() ;
259
260 // Methods
261 virtual void setDefaultOnNonWritingFields() ;
262 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
263
264 private:
265 inline SbBool isAnnoText() const ;
266 void eraseAllParts() ;
267 void buildSliceAttrList(const PbMesh1D *mesh1D, float &maxSliceHeight,
268 SbBool &isConstantHeight) ;
269 void buildSliceText(int sliceIndex, float maxSliceHeight, SoGroup *annoGroup,
270 SoGroup *annoLineGroup) ;
271
272 // Data
273 SliceAttr *m_sliceAttrList ;
274 int m_numSliceAttr ;
275
276 // Sensors
277 FieldSensorList fieldSensorList ;
278
279 // List of fields defined in this class
280 SoFieldList fieldList ;
281} ;
282
283/*----------------------------------------------------------------------------*/
284
285#endif /* _PO_PIE_CHART_REP_ */
286
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract mono...
Definition PbMesh1D.h:42
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract base class for ...
Definition PoChart.h:44
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to build a 3D pie ...
SoSFFloat annoDistToCenter
Defines the distance from the pie chart center of the displayed annotations (name/value/percentage).
SoSFFloat radiusMin
Defines the mininum radius of the pie chart.
SoSFFloat height
Defines the height of the pie chart if the field yValuesIndex is different from -1.
float getSliceToTranslate(int sliceNumber) const
Gets the current translation of a slice.
SoSFBool isPercentageVisible
Defines if the percentage of each slice is visible.
PoPieChartRep()
Constructor.
SoMFFloat sliceToTranslateRadius
Translation values along the bisectors of the slices.
SoSFBool isValueVisible
Defines if the value of each slice is visible.
SoSFInt32 stringsIndex
Defines the index of the set of strings used for the names attached to slices.
SoSFFloat annoHeightFromSlice
Defines the height of the displayed annotations (name/value/percentage) from the top of each slice.
SoSFBool isAnnoSliceColor
Determines if the color of for annotation is the same as slices.
void setSliceToTranslate(int sliceNumber, float radius)
Convenience methods to set the fields sliceToTranslateNumber and sliceToTranslateRadius.
SoSFBool isNameVisible
Defines if the name of each slice is visible.
SoSFFloat radiusMax
Defines the maximum radius of the pie chart.
SoMFShort sliceToTranslateNumber
Numbers (slice numbers begin at 0) of the slices to translate.
SbBool getPickedSliceNumber(const SoPath *path, int &sliceNumber) const
Allow the user to retreive the slice number (sliceNumber argument) which has been picked from a picke...
SoSFFloat annoFontSize
Define the font size of the annotation.
Class for smart character strings.
Definition SbString.h:202
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 floating point values.
Definition SoMFFloat.h:90
Multiple-value field containing any number of short integers.
Definition SoMFShort.h:89
Surface material definition node.
Definition SoMaterial.h:173
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Node representing a 3D translation.
int SbBool
Boolean type.
Definition SbBase.h:87