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