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