00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _PO_LEGEND_
00026 #define _PO_LEGEND_
00027
00028 #include <MeshViz/graph/PoGraphMaster.h>
00029
00030 #include <Inventor/fields/SoSFEnum.h>
00031 #include <Inventor/fields/SoSFFloat.h>
00032 #include <Inventor/fields/SoSFBool.h>
00033 #include <Inventor/fields/SoSFUShort.h>
00034 #include <Inventor/fields/SoSFString.h>
00035
00036 class PbMiscTextAttr ;
00037 class PiText ;
00038
00056 class PoLegend : public PoGraphMaster {
00057
00058 SO_KIT_HEADER(PoLegend) ;
00059
00060
00061 SO_KIT_CATALOG_ENTRY_HEADER(backgroundSep) ;
00062 SO_KIT_CATALOG_ENTRY_HEADER(backgroundApp) ;
00063 SO_KIT_CATALOG_ENTRY_HEADER(background) ;
00064
00065 SO_KIT_CATALOG_ENTRY_HEADER(backgroundBorderSep) ;
00066 SO_KIT_CATALOG_ENTRY_HEADER(backgroundBorderApp) ;
00067 SO_KIT_CATALOG_ENTRY_HEADER(backgroundBorder) ;
00068
00069 SO_KIT_CATALOG_ENTRY_HEADER(boxSep) ;
00070 SO_KIT_CATALOG_ENTRY_HEADER(boxApp) ;
00071 SO_KIT_CATALOG_ENTRY_HEADER(box) ;
00072
00073 SO_KIT_CATALOG_ENTRY_HEADER(boxBorderSep) ;
00074 SO_KIT_CATALOG_ENTRY_HEADER(boxBorderApp) ;
00075 SO_KIT_CATALOG_ENTRY_HEADER(boxBorder) ;
00076
00077 SO_KIT_CATALOG_ENTRY_HEADER(titleSep) ;
00078 SO_KIT_CATALOG_ENTRY_HEADER(titleApp) ;
00079 SO_KIT_CATALOG_ENTRY_HEADER(title) ;
00080
00081 SO_KIT_CATALOG_ENTRY_HEADER(valueTextSep) ;
00082 SO_KIT_CATALOG_ENTRY_HEADER(valueTextApp) ;
00083 SO_KIT_CATALOG_ENTRY_HEADER(valueText) ;
00084
00085
00086 public:
00087
00091 enum Visibility {
00095 VISIBILITY_OFF,
00099 VISIBILITY_ON
00100 } ;
00101
00105 enum TextPath {
00109 PATH_RIGHT,
00113 PATH_LEFT,
00117 PATH_UP,
00121 PATH_DOWN
00122 } ;
00123
00127 enum Position {
00131 POS_BOTTOM,
00135 POS_TOP,
00139 POS_RIGHT,
00143 POS_LEFT
00144 } ;
00145
00149 enum MarginType {
00153 REL_MARGIN,
00157 FIXED_MARGIN
00158 } ;
00159
00163 enum IncrementType {
00167 VERTICAL_INCREMENT,
00171 HORIZONTAL_INCREMENT
00172 } ;
00173
00174
00175
00176
00177
00178
00179
00183 SoSFEnum titleVisibility ;
00184
00188 SoSFEnum titlePosition ;
00189
00194 SoSFEnum titlePath ;
00195
00199 SoSFFloat titleFontSize ;
00200
00206 SoSFString titleFontName ;
00207
00211 SoSFString titleString ;
00212
00213
00214
00218 SoSFEnum valueVisibility ;
00219
00223 SoSFEnum valuePosition ;
00224
00230 SoSFString valueFontName ;
00231
00235 SoSFBool valueAddStringVisibility ;
00236
00240 SoSFString valueAddString ;
00241
00242
00243
00247 SoSFEnum marginType ;
00248
00252 SoSFFloat marginLeft ;
00253
00257 SoSFFloat marginRight ;
00258
00262 SoSFFloat marginBottom ;
00263
00267 SoSFFloat marginTop ;
00268
00269
00270
00275 SoSFEnum incrementType ;
00276
00280 SoSFUShort numColumns ;
00281
00282
00283
00287 SoSFFloat boxRatio ;
00288
00289
00290
00291
00292
00299 void setMiscTextAttr(PbMiscTextAttr *textAttr) ;
00300
00304 const PbMiscTextAttr *getMiscTextAttr() const ;
00305
00306
00307 private:
00308 static void initClass() ;
00309 static void exitClass() ;
00310
00311 private:
00312 struct LegendAttr {
00313 float titleFontSize ;
00314 SbString titleFontName ;
00315
00316 float valueFontSize ;
00317 SbString valueFontName ;
00318 } ;
00319
00320
00321 virtual void setDefaultOnNonWritingFields() ;
00322 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00323
00324
00325 virtual void basicObjectChange(PbBase *basicObj) ;
00326
00327
00328
00329
00330 void computeMarginA(const SbVec2f &ptBoxOrig, float boxWidth,
00331 float boxHeight, SbVec2f &ptLegendOrig,
00332 float &legendWidth, float &legendHeight) ;
00333
00334
00335 void computeTitleSizeA(float legendWidth, float legendHeight,
00336 float &titleWidth, float &titleHeight) ;
00337
00338
00339 void drawBackgroundA(const SbVec2f &ptBoxOrig, float boxWidth, float boxHeight) ;
00340
00341
00342 void drawTitleA(float titleHeight, float titleWidth, Plimit &limit) ;
00343
00344
00345 void drawBoxesLegendBoxesA(SbBool isBoxVisible, float boxWidth, float boxHeight,
00346 int nb_lines, int nb_columns,
00347 int numItems, const float *maxTextSizePerCol,
00348 const SbVec2f &space_box, const Plimit &limit) ;
00349
00350
00351 virtual void drawBoxLegendBoxesA(SoGroup *boxBorderGroup, SoGroup *boxGroup,
00352 const SbVec2f &topLeftCorner, float width,
00353 float height, int repIndex) ;
00354
00355
00356 void drawValuesLegendBoxesA(int nb_lines, int nb_columns, int numStrings,
00357 const SbString *strings, const float *maxTextSizePerCol,
00358 const SbVec2f &space_box, const Plimit &limit,
00359 PiText &valText) ;
00360
00361
00362
00363 virtual void computeGraphicSizeForValues(float &width, float &height,
00364 float &text_space) ;
00365
00366
00367 virtual void setRevertOrder(float startY, float endY)
00368 { m_revertOrder = (startY <= endY ? FALSE : TRUE) ; }
00369 SbBool isRevertOrder() const
00370 { return m_revertOrder ; }
00371
00372
00373
00374
00375 SbBool m_revertOrder ;
00376
00377
00378
00379 void setDefaultAttr() ;
00380
00381
00382 PoLegend() ;
00383
00384
00385 virtual ~PoLegend() ;
00386
00387
00388 virtual void addElementsAllCaches() ;
00389 virtual void preRebuild() ;
00390
00391
00392 LegendAttr m_legendAttr ;
00393
00394 private:
00395
00396 PbMiscTextAttr *m_miscTextAttr, *m_defaultMiscTextAttr ;
00397
00398
00399 FieldSensorList m_fieldSensorList ;
00400
00401
00402 SoFieldList m_fieldList ;
00403
00404 } ;
00405
00406
00407
00408 #endif
00409
00410
00411
00412