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 *** MERIGNAC, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 #ifndef _PO_VALUE_LEGEND_ 00025 #define _PO_VALUE_LEGEND_ 00026 00027 #include <MeshViz/graph/PoLegend.h> 00028 00029 #include <MeshViz/graph/PbNumericDisplayFormat.h> 00030 #include <MeshViz/graph/PbDataMapping.h> 00031 00032 #include <Inventor/fields/SoSFUShort.h> 00033 #include <Inventor/fields/SoSFString.h> 00034 00035 class PbIsovaluesList ; 00036 00078 class PoValueLegend : public PoLegend { 00079 00080 SO_KIT_HEADER(PoValueLegend) ; 00081 00082 /* Define fields for new parts */ 00083 SO_KIT_CATALOG_ENTRY_HEADER(multFactorSep) ; 00084 SO_KIT_CATALOG_ENTRY_HEADER(multFactorApp) ; 00085 SO_KIT_CATALOG_ENTRY_HEADER(multFactor) ; 00086 00087 00088 public: 00089 00090 /* Fields */ 00091 00098 SoSFString upperUndefString ; 00099 00106 SoSFString lowerUndefString ; 00107 00111 SoSFUShort periodValue ; 00112 00116 SoSFUShort firstValue ; 00117 00121 SoSFUShort lastValue ; 00122 00123 00124 00125 /* Methods */ 00126 00134 void setIsovaluesList(PbIsovaluesList *isovaluesList) ; 00135 00139 const PbIsovaluesList* getIsovaluesList() const ; 00140 00147 void setDataMapping(PbDataMapping *dataMapping) ; 00148 00152 const PbDataMapping *getDataMapping() const ; 00153 00161 void setFormat(PbNumericDisplayFormat *format) ; 00162 00167 const PbNumericDisplayFormat *getFormat() const ; 00168 00169 /*----------------------------------------------------------------------------*/ 00170 private: 00171 static void initClass() ; 00172 static void exitClass() ; 00173 00174 private: 00175 // Box representation definition 00176 // This structure is the representation of one box 00177 struct BoxRepresentation { 00178 int numColors ; // = 0 no color, = -1 inherited color 00179 SbColor colorList[2] ; 00180 float value ; 00181 float value2 ; // Use for interval legend 00182 float transparency ; 00183 float transparency2 ; // Use for interval legend 00184 SbBool isTransparency ; 00185 SbString string ; 00186 00187 float *percentPerColor ; // Not used for the moment 00188 SbBool isColorShaded ; // Not used for the moment 00189 } ; 00190 00191 enum LegendType { 00192 DATA_MAPPING_LEGEND, 00193 ISOVALUE_LEGEND, 00194 NO_LEGEND 00195 } ; 00196 00197 enum LegendOrientation { 00198 HORIZONTAL_LEGEND, 00199 VERTICAL_LEGEND 00200 } ; 00201 00202 enum MultFactorPosition { 00203 MULT_FACTOR_POS_UP_MIDDLE, 00204 MULT_FACTOR_POS_RIGHT_MIDDLE, 00205 MULT_FACTOR_POS_DOWN_MIDDLE 00206 } ; 00207 00208 // Constructor 00209 PoValueLegend() ; 00210 00211 // Methods 00212 virtual void setDefaultOnNonWritingFields() ; 00213 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ; 00214 00215 // Destructor 00216 virtual ~PoValueLegend() ; 00217 00218 // Manage the connection with PbBase objects 00219 virtual void basicObjectChange(PbBase *basicObj) ; 00220 00221 // Compute boxes representation 00222 void computeBoxColors(int index, SbBool isIntervalLegend) ; 00223 00224 // Compute undef box representation 00225 // lowerUndefIndex = -1 no lower undef representation 00226 // upperUndefIndex = -1 no upper undef representation 00227 void computeUndefBoxRepresentation(int lowerUndefIndex, int upperUndefIndex) ; 00228 00229 // Compute list of values 00230 void computeValuesList() ; 00231 00232 // Create box representation list 00233 void newBoxRepresentationList(int num) ; 00234 00235 // Delete box representation list 00236 void deleteBoxRepresentationList() ; 00237 00238 // Overloaded methods 00239 virtual void addElementsAllCaches() ; 00240 virtual void preRebuild() ; 00241 00242 // List of boxes representation 00243 BoxRepresentation *m_boxRepresentationList ; 00244 int m_numBoxRepresentation ; 00245 00246 // List of values to display (this list is computed thanks to 00247 // data mapping and isovalues list). 00248 float *m_valuesList ; 00249 int m_numberValues ; 00250 SbBool m_isLowerUndef, m_isUpperUndef ; 00251 LegendType m_legendType ; 00252 00253 // DataMapping Type 00254 PbDataMapping::ClassType m_dataMappingType ; 00255 float m_transparencyDeletedParts ; 00256 00257 // Orientation of the legend (HORIZONTAL or VERTICAL) 00258 LegendOrientation m_legendOrientation ; 00259 00260 // Multiplicative factor in the legend 00261 SbBool m_isMultFactor ; 00262 SbString m_multFactorExpString ; // Exponent of the mult factor 00263 float m_multFactorWidth ; 00264 00265 private: 00266 // Default numeric format 00267 PbNumericDisplayFormat m_defaultNumericFormat ; 00268 00269 // Numeric diplay format 00270 PbNumericDisplayFormat *m_numericDisplayFormat ; 00271 00272 // Data mapping 00273 PbDataMapping *m_dataMap ; 00274 00275 // Isovalue list 00276 PbIsovaluesList *m_isovalList ; 00277 00278 // Sensors 00279 FieldSensorList m_fieldSensorList ; 00280 00281 // List of fields defined in this class 00282 SoFieldList m_fieldList ; 00283 } ; 00284 00285 /*----------------------------------------------------------------------------*/ 00286 00287 #endif /* _PO_VALUE_LEGEND_ */ 00288 00289 00290 00291 00292