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_AUTO_VALUE_LEGEND_
00025 #define _PO_AUTO_VALUE_LEGEND_
00026
00027 #include <MeshViz/graph/PoValueLegend.h>
00028
00029 #include <Inventor/fields/SoSFVec2f.h>
00030
00047 class PoAutoValueLegend : public PoValueLegend {
00048
00049 SO_KIT_HEADER(PoAutoValueLegend) ;
00050
00051
00052 public:
00053
00054
00055
00063 SoSFVec2f start ;
00064
00068 SoSFVec2f end ;
00069
00070
00071 private:
00072 static void initClass() ;
00073 static void exitClass() ;
00074
00075 private:
00076
00077 PoAutoValueLegend()
00078 { init(SbVec2f(0., 0.), SbVec2f(1., 1.)) ; }
00079
00080 PoAutoValueLegend(const SbVec2f &_start, const SbVec2f &_end)
00081 { init(_start, _end) ; }
00082
00083
00084 virtual void setDefaultOnNonWritingFields() ;
00085 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00086
00087
00088 virtual ~PoAutoValueLegend() ;
00089
00090
00091 void drawMultFactor(MultFactorPosition position, Plimit &limit) ;
00092
00093
00094
00095
00096 void computeStrFtSizeLegendBoxes(float legend_width, float legend_height, int nb_lines,
00097 int nb_columns, float f0, float *maxTextSizePerCol,
00098 SbVec2f &space_box) ;
00099
00100
00101
00102 void computeGraphicSizeForValues(float &width, float &height, float &text_space) ;
00103
00104
00105 void drawBoxesLegend(int numStrings, const SbString *strings) ;
00106
00107
00108 void drawBoxLegendBoxesA(SoGroup *boxBorderGroup, SoGroup *boxGroup,
00109 const SbVec2f &topLeftCorner, float width, float height,
00110 int repIndex) ;
00111
00112
00113
00114 enum ValDistrib {
00115 ALL_VAL,
00116 LINEAR_VAL,
00117 MIN_MAX_VAL
00118 } ;
00119
00120
00121 void drawOneBoxLegend(ValDistrib val_distrib, SbBool isLinear, SbBool isLowerUpperBoxes) ;
00122
00123
00124
00125 void computeUndefBoxOneBoxLegend(float &legend_width, float &legend_height,
00126 float &undef_box_width, float &undef_box_height,
00127 float &undef_box_space) ;
00128
00129
00130 void drawValuesRectOneBoxLegend(float val_rect_height, float val_rect_width,
00131 int lower_undef_index, const float *val_rect_dist,
00132 const Plimit &limit) ;
00133
00134
00135 void drawUndefBoxesOneBoxLegend(float text_offset, float undef_box_height,
00136 float undef_box_width, float undef_box_space,
00137 int lower_undef_index, int upper_undef_index,
00138 Plimit &limit) ;
00139
00140
00141 void drawValuesOneBoxLegend(float val_rect_width, float val_rect_height,
00142 float text_offset, const float *val_dist,
00143 SbString *val_str, int num_val, const Plimit &limit) ;
00144
00145
00146 void computeValFtSizeOneBoxLegend(ValDistrib val_distrib, float legend_width, float legend_height,
00147 int lower_undef_index, int upper_undef_index,
00148 float undef_box_width, float undef_box_height,
00149 const float *val_rect_dist, int &num_val_to_display,
00150 SbString **val_str, float **val_dist, float &val_width,
00151 float &val_height) ;
00152
00153 float m_maxValueSize ;
00154
00155 private:
00156
00157 void init(const SbVec2f &_start, const SbVec2f &_end) ;
00158
00159
00160 FieldSensorList m_fieldSensorList ;
00161
00162
00163 SoFieldList m_fieldList ;
00164
00165
00166 SbBool m_isLowerUpperBoxes ;
00167 } ;
00168
00169
00170
00171 #endif
00172
00173
00174
00175