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_POLAR_LOG_AXIS_
00025 #define _PO_POLAR_LOG_AXIS_
00026
00027 #include <Inventor/fields/SoSFEnum.h>
00028 #include <Inventor/fields/SoSFFloat.h>
00029 #include <Inventor/fields/SoMFUShort.h>
00030 #include <Inventor/fields/SoSFString.h>
00031
00032 #include <MeshViz/graph/PoPolarAxis.h>
00033
00102 class PoPolarLogAxis : public PoPolarAxis {
00103
00104 SO_KIT_HEADER(PoPolarLogAxis) ;
00105
00106
00107 SO_KIT_CATALOG_ENTRY_HEADER(decadeTextSep) ;
00108 SO_KIT_CATALOG_ENTRY_HEADER(decadeTextApp) ;
00109 SO_KIT_CATALOG_ENTRY_HEADER(decadeText) ;
00110
00111
00112 public:
00113
00117 enum DecadeListDef {
00121 DECADE_LIST_AUTO,
00125 DECADE_LIST_NON_AUTO
00126 } ;
00127
00131 enum TenPowGradRep {
00135 TEN_POWER_POW10,
00139 TEN_POWER_DECIMAL,
00143 TEN_POWER_AUTO
00148 } ;
00149
00153 enum DecadeRep {
00157 DECADE_NONE,
00161 DECADE_AS_TEN_POWER,
00165 DECADE_DECIMAL,
00169 DECADE_DIGIT,
00177 DECADE_AUTO
00182 } ;
00183
00184
00185
00186
00187
00192 SoMFUShort decadeList ;
00193
00200 SoSFEnum decadeListDef ;
00201
00206 SoSFEnum tenPowerRep ;
00207
00212 SoSFEnum decadeRep ;
00213
00218 SoSFString decadeFontName ;
00219
00225 SoSFFloat decadeFontSize ;
00226
00227
00228
00232 PoPolarLogAxis() ;
00233
00237 PoPolarLogAxis(float offset, float startRadius, float endRadius, float theta,
00238 DecadeListDef decadeListDef = DECADE_LIST_AUTO,
00239 const unsigned short *decadeList = NULL, short numDecade = 0) ;
00240
00244 virtual void rebuild() ;
00245
00251 void getLogGrad(unsigned short &numDecade, unsigned short decadeList[8],
00252 TenPowGradRep &tenPowerRep, DecadeRep &decadeRep,
00253 SbString &decadeFontName, float &decadeFontSize) const ;
00254
00255
00256
00257
00258 private:
00259 static void initClass() ;
00260 static void exitClass() ;
00261
00262 struct Decade {
00263 DecadeRep rep ;
00264 DecadeListDef listDef ;
00265 int *gradList ;
00266 size_t number ;
00267 SbString fontName ;
00268 float fontSize ;
00269 } ;
00270
00271 private:
00272 struct PolLogAxisAttr {
00273 TenPowGradRep tenPowerRep ;
00274 Decade decadeGrad ;
00275 } ;
00276
00277
00278
00279
00280 virtual ~PoPolarLogAxis() ;
00281 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00282 virtual void setDefaultOnNonWritingFields() ;
00283
00284
00285 virtual void saveAxisAttr() ;
00286
00287 private:
00288
00289 void init(SbBool isDefault, DecadeListDef decadeListDef = DECADE_LIST_AUTO,
00290 const unsigned short *decadeList = NULL, short numDecade = 0) ;
00291
00292
00293
00294 void buildLogGrad(const std::vector<float> &mainGradX, std::vector<float> &secdGradX,
00295 size_t numDecades, int *decades, int firstDecInd,
00296 SoGroup *mainGroup, SoGroup *secondaryGroup) ;
00297
00298
00299 void computeLogGradFontSize(size_t numMainGrad, const char **main_str,
00300 const char **main_ten_pow_str, size_t numSecdGrad,
00301 const char **secd_str, const char **secd_ten_pow_str,
00302 float min_grad_dist, SbBool main_grad_pres_auto,
00303 float &main_font_size, float &secd_font_size) ;
00304
00305
00306 PolLogAxisAttr polLogAxisAttr ;
00307
00308
00309 FieldSensorList fieldSensorList ;
00310
00311
00312 SoFieldList fieldList ;
00313
00314 } ;
00315
00316
00317
00318 #endif
00319
00320