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
00055 class PoLegend : public PoGraphMaster {
00056
00057 SO_KIT_HEADER(PoLegend) ;
00058
00059
00060 SO_KIT_CATALOG_ENTRY_HEADER(backgroundSep) ;
00061 SO_KIT_CATALOG_ENTRY_HEADER(backgroundApp) ;
00062 SO_KIT_CATALOG_ENTRY_HEADER(background) ;
00063
00064 SO_KIT_CATALOG_ENTRY_HEADER(backgroundBorderSep) ;
00065 SO_KIT_CATALOG_ENTRY_HEADER(backgroundBorderApp) ;
00066 SO_KIT_CATALOG_ENTRY_HEADER(backgroundBorder) ;
00067
00068 SO_KIT_CATALOG_ENTRY_HEADER(boxSep) ;
00069 SO_KIT_CATALOG_ENTRY_HEADER(boxApp) ;
00070 SO_KIT_CATALOG_ENTRY_HEADER(box) ;
00071
00072 SO_KIT_CATALOG_ENTRY_HEADER(boxBorderSep) ;
00073 SO_KIT_CATALOG_ENTRY_HEADER(boxBorderApp) ;
00074 SO_KIT_CATALOG_ENTRY_HEADER(boxBorder) ;
00075
00076 SO_KIT_CATALOG_ENTRY_HEADER(titleSep) ;
00077 SO_KIT_CATALOG_ENTRY_HEADER(titleApp) ;
00078 SO_KIT_CATALOG_ENTRY_HEADER(title) ;
00079
00080 SO_KIT_CATALOG_ENTRY_HEADER(valueTextSep) ;
00081 SO_KIT_CATALOG_ENTRY_HEADER(valueTextApp) ;
00082 SO_KIT_CATALOG_ENTRY_HEADER(valueText) ;
00083
00084
00085 public:
00086
00090 enum Visibility {
00094 VISIBILITY_OFF,
00098 VISIBILITY_ON
00099 } ;
00100
00104 enum TextPath {
00108 PATH_RIGHT,
00112 PATH_LEFT,
00116 PATH_UP,
00120 PATH_DOWN
00121 } ;
00122
00126 enum Position {
00130 POS_BOTTOM,
00134 POS_TOP,
00138 POS_RIGHT,
00142 POS_LEFT
00143 } ;
00144
00148 enum MarginType {
00152 REL_MARGIN,
00156 FIXED_MARGIN
00157 } ;
00158
00162 enum IncrementType {
00166 VERTICAL_INCREMENT,
00170 HORIZONTAL_INCREMENT
00171 } ;
00172
00173
00174
00175
00176
00177
00178
00182 SoSFEnum titleVisibility ;
00183
00187 SoSFEnum titlePosition ;
00188
00193 SoSFEnum titlePath ;
00194
00198 SoSFFloat titleFontSize ;
00199
00205 SoSFString titleFontName ;
00206
00210 SoSFString titleString ;
00211
00212
00213
00217 SoSFEnum valueVisibility ;
00218
00222 SoSFEnum valuePosition ;
00223
00229 SoSFString valueFontName ;
00230
00234 SoSFBool valueAddStringVisibility ;
00235
00239 SoSFString valueAddString ;
00240
00241
00242
00246 SoSFEnum marginType ;
00247
00251 SoSFFloat marginLeft ;
00252
00256 SoSFFloat marginRight ;
00257
00261 SoSFFloat marginBottom ;
00262
00266 SoSFFloat marginTop ;
00267
00268
00269
00274 SoSFEnum incrementType ;
00275
00279 SoSFUShort numColumns ;
00280
00281
00282
00286 SoSFFloat boxRatio ;
00287
00288
00289
00290
00291
00298 void setMiscTextAttr(PbMiscTextAttr *textAttr) ;
00299
00303 const PbMiscTextAttr *getMiscTextAttr() const ;
00304
00305
00306 private:
00307 static void initClass() ;
00308 static void exitClass() ;
00309
00310 private:
00311 struct LegendAttr {
00312 float titleFontSize ;
00313 SbString titleFontName ;
00314
00315 float valueFontSize ;
00316 SbString valueFontName ;
00317 } ;
00318
00319
00320 virtual void setDefaultOnNonWritingFields() ;
00321 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00322
00323
00324 virtual void basicObjectChange(PbBase *basicObj) ;
00325
00326
00327
00328
00329 void computeMarginA(const SbVec2f &ptBoxOrig, float boxWidth,
00330 float boxHeight, SbVec2f &ptLegendOrig,
00331 float &legendWidth, float &legendHeight) ;
00332
00333
00334 void computeTitleSizeA(float legendWidth, float legendHeight,
00335 float &titleWidth, float &titleHeight) ;
00336
00337
00338 void drawBackgroundA(const SbVec2f &ptBoxOrig, float boxWidth, float boxHeight) ;
00339
00340
00341 void drawTitleA(float titleHeight, float titleWidth, Plimit &limit) ;
00342
00343
00344 void drawBoxesLegendBoxesA(SbBool isBoxVisible, float boxWidth, float boxHeight,
00345 int nb_lines, int nb_columns,
00346 int numItems, const float *maxTextSizePerCol,
00347 const SbVec2f &space_box, const Plimit &limit) ;
00348
00349
00350 virtual void drawBoxLegendBoxesA(SoGroup *boxBorderGroup, SoGroup *boxGroup,
00351 const SbVec2f &topLeftCorner, float width,
00352 float height, int repIndex) ;
00353
00354
00355 void drawValuesLegendBoxesA(int nb_lines, int nb_columns, int numStrings,
00356 const SbString *strings, const float *maxTextSizePerCol,
00357 const SbVec2f &space_box, const Plimit &limit,
00358 PiText &valText) ;
00359
00360
00361
00362 virtual void computeGraphicSizeForValues(float &width, float &height,
00363 float &text_space) ;
00364
00365
00366 virtual void setRevertOrder(float startY, float endY)
00367 { m_revertOrder = (startY <= endY ? FALSE : TRUE) ; }
00368 SbBool isRevertOrder() const
00369 { return m_revertOrder ; }
00370
00371
00372
00373
00374 SbBool m_revertOrder ;
00375
00376
00377
00378 void setDefaultAttr() ;
00379
00380
00381 PoLegend() ;
00382
00383
00384 virtual ~PoLegend() ;
00385
00386
00387 virtual void addElementsAllCaches() ;
00388 virtual void preRebuild() ;
00389
00390
00391 LegendAttr m_legendAttr ;
00392
00393 private:
00394
00395 PbMiscTextAttr *m_miscTextAttr, *m_defaultMiscTextAttr ;
00396
00397
00398 FieldSensorList m_fieldSensorList ;
00399
00400
00401 SoFieldList m_fieldList ;
00402
00403 } ;
00404
00405
00406
00407 #endif
00408
00409
00410
00411