00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _PO_ITEM_LEGEND_
00025 #define _PO_ITEM_LEGEND_
00026
00027 #include <MeshViz/graph/PoLegend.h>
00028
00029 #include <Inventor/fields/SoSFVec2f.h>
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/fields/SoMFString.h>
00032 #include <Inventor/fields/SoMFColor.h>
00033 #include <Inventor/fields/SoMFUShort.h>
00034 #include <Inventor/fields/SoMFFloat.h>
00035
00036 class PiText ;
00037
00094 class PoItemLegend : public PoLegend {
00095
00096 SO_KIT_HEADER(PoItemLegend) ;
00097
00098
00099 SO_KIT_CATALOG_ENTRY_HEADER(lineSep) ;
00100 SO_KIT_CATALOG_ENTRY_HEADER(lineApp) ;
00101 SO_KIT_CATALOG_ENTRY_HEADER(line) ;
00102
00103 SO_KIT_CATALOG_ENTRY_HEADER(markerSep) ;
00104 SO_KIT_CATALOG_ENTRY_HEADER(markerApp) ;
00105 SO_KIT_CATALOG_ENTRY_HEADER(marker) ;
00106
00107
00108 public:
00109
00110
00111
00115 SoSFVec2f start ;
00116
00120 SoSFVec2f end ;
00121
00125 SoMFString item ;
00126
00127
00128
00132 SoSFBool boxVisibility ;
00133
00139 SoMFColor boxColor ;
00140
00141
00142
00146 SoSFBool lineVisibility ;
00147
00151 SoMFColor lineColor ;
00152
00156 SoMFFloat lineSize ;
00157
00163 SoMFUShort linePattern ;
00164
00165
00166
00170 SoSFBool markerVisibility ;
00171
00178 SoMFColor markerColor ;
00179
00186 SoMFFloat markerSize ;
00187
00197 SoMFString markerString ;
00198
00199
00200
00201
00202
00206 PoItemLegend()
00207 { init(TRUE, SbVec2f(0.,0.), SbVec2f(1.,1.), 0, NULL, NULL) ; }
00208
00213 PoItemLegend(const SbVec2f &_start, const SbVec2f &_end, int _numItems,
00214 const char** _item, const SbColor *_boxColor=NULL)
00215 { init(FALSE, _start, _end, _numItems, _item, _boxColor) ; }
00216
00220 virtual void rebuild() ;
00221
00222
00223
00224
00225 private:
00226 static void initClass() ;
00227 static void exitClass() ;
00228
00229 private:
00230
00231 virtual void setDefaultOnNonWritingFields() ;
00232 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00233
00234
00235 virtual ~PoItemLegend() ;
00236
00237
00238 virtual void setRevertOrder(float startY, float endY)
00239 { m_revertOrder = (startY <= endY ? TRUE : FALSE) ; }
00240
00241 private:
00242
00243 void init(SbBool isDefault, const SbVec2f &_start, const SbVec2f &_end,
00244 int _numItems, const char** _item, const SbColor *_boxColor) ;
00245
00246
00247 void computeItemFontSize(float legend_width, float legend_height, int nb_lines,
00248 int nb_columns, float f0, float *maxTextSizePerCol,
00249 SbVec2f &space_box) ;
00250
00251
00252 void drawBoxLegendBoxesA(SoGroup *boxBorderGroup, SoGroup *boxGroup,
00253 const SbVec2f &topLeftCorner, float width, float height,
00254 int repIndex) ;
00255
00256
00257 void drawLines(int nb_lines, int nb_columns, int numItems,
00258 const float *maxTextSizePerCol, const SbVec2f &space_box,
00259 const Plimit ¤t_limit) ;
00260
00261
00262 void drawHorLine(SoGroup *lineGroup, const SbVec2f &orig, float size,
00263 SbBool isColor, SbBool isSize, SbBool isPattern, int repIndex) ;
00264
00265
00266 void drawMarkers(int nb_lines, int nb_columns, int numItems,
00267 const float *maxTextSizePerCol, const SbVec2f &space_box,
00268 const Plimit ¤t_limit) ;
00269
00270
00271 void drawMarker(SoGroup *markerGroup, const SbVec2f &orig, SbBool isColor,
00272 SbBool isSize, SbBool isType, int repIndex) ;
00273
00274
00275
00276 void computeGraphicSizeForValues(float &width, float &height,
00277 float &text_space) ;
00278
00279
00280 FieldSensorList m_fieldSensorList ;
00281
00282
00283 SoFieldList m_fieldList ;
00284 } ;
00285
00286
00287
00288 #endif
00289
00290
00291
00292