00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 #ifndef _PO_PIE_CHART_REP_ 00025 #define _PO_PIE_CHART_REP_ 00026 00027 #include <MeshViz/graph/PoChart.h> 00028 00029 #include <Inventor/fields/SoSFBool.h> 00030 #include <Inventor/fields/SoSFFloat.h> 00031 #include <Inventor/fields/SoMFFloat.h> 00032 #include <Inventor/fields/SoMFShort.h> 00033 #include <Inventor/fields/SoSFString.h> 00034 00035 class SoTranslation ; 00036 class PbMesh1D ; 00037 00100 class PoPieChartRep : public PoChart { 00101 00102 SO_KIT_HEADER(PoPieChartRep) ; 00103 00104 /* Define fields for new parts */ 00105 SO_KIT_CATALOG_ENTRY_HEADER(sliceSep) ; 00106 SO_KIT_CATALOG_ENTRY_HEADER(sliceApp) ; 00107 SO_KIT_CATALOG_ENTRY_HEADER(slice) ; 00108 00109 SO_KIT_CATALOG_ENTRY_HEADER(annotationSep) ; 00110 SO_KIT_CATALOG_ENTRY_HEADER(annotationApp) ; 00111 SO_KIT_CATALOG_ENTRY_HEADER(annotation) ; 00112 00113 SO_KIT_CATALOG_ENTRY_HEADER(annotationLineSep) ; 00114 SO_KIT_CATALOG_ENTRY_HEADER(annotationLineApp) ; 00115 SO_KIT_CATALOG_ENTRY_HEADER(annotationLine) ; 00116 00117 00118 public: 00119 00120 /* Fields */ 00121 00127 SoSFInt32 stringsIndex ; 00128 00133 SoSFFloat radiusMin ; 00134 00138 SoSFFloat radiusMax ; 00139 00144 SoMFShort sliceToTranslateNumber ; 00145 00151 SoMFFloat sliceToTranslateRadius ; 00152 00157 SoSFFloat height ; 00158 00164 SoSFBool isNameVisible ; 00165 00169 SoSFBool isValueVisible ; 00170 00174 SoSFBool isPercentageVisible ; 00175 00180 SoSFFloat annoDistToCenter ; 00181 00186 SoSFFloat annoHeightFromSlice ; 00187 00191 SoSFFloat annoFontSize ; 00192 00196 SoSFBool isAnnoSliceColor ; 00197 00201 PoPieChartRep() ; 00202 00211 SbBool getPickedSliceNumber(const SoPath *path, int &sliceNumber) const ; 00212 00223 void setSliceToTranslate(int sliceNumber, float radius) ; 00224 00230 float getSliceToTranslate(int sliceNumber) const ; 00231 00232 /*----------------------------------------------------------------------------*/ 00233 00234 00235 private: 00236 static void initClass() ; 00237 static void exitClass() ; 00238 00239 private: 00240 struct SliceAttr { 00241 float startAngle ; 00242 float endAngle ; 00243 float value ; 00244 float height ; 00245 SbString nameStr ; 00246 SbString percentageStr ; 00247 SbString valueStr ; 00248 SoMaterial *material ; 00249 SoTranslation *translation ; 00250 } ; 00251 00252 virtual ~PoPieChartRep() ; 00253 // Destructor. 00254 00255 // Overloaded methods 00256 virtual void rebuild() ; 00257 virtual void addElementsAllCaches() ; 00258 virtual void preRebuild() ; 00259 00260 // Methods 00261 virtual void setDefaultOnNonWritingFields() ; 00262 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ; 00263 00264 private: 00265 inline SbBool isAnnoText() const ; 00266 void eraseAllParts() ; 00267 void buildSliceAttrList(const PbMesh1D *mesh1D, float &maxSliceHeight, 00268 SbBool &isConstantHeight) ; 00269 void buildSliceText(int sliceIndex, float maxSliceHeight, SoGroup *annoGroup, 00270 SoGroup *annoLineGroup) ; 00271 00272 // Data 00273 SliceAttr *m_sliceAttrList ; 00274 int m_numSliceAttr ; 00275 00276 // Sensors 00277 FieldSensorList fieldSensorList ; 00278 00279 // List of fields defined in this class 00280 SoFieldList fieldList ; 00281 } ; 00282 00283 /*----------------------------------------------------------------------------*/ 00284 00285 #endif /* _PO_PIE_CHART_REP_ */ 00286 00287