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_LOG_AXIS_
00025 #define _PO_LOG_AXIS_
00026
00027
00028 #include <Inventor/fields/SoSFEnum.h>
00029 #include <Inventor/fields/SoSFFloat.h>
00030 #include <Inventor/fields/SoMFUShort.h>
00031 #include <Inventor/fields/SoSFString.h>
00032
00033
00034 #include <MeshViz/graph/PoCartesianAxis.h>
00035
00110 class PoLogAxis : public PoCartesianAxis {
00111
00112 SO_KIT_HEADER(PoLogAxis) ;
00113
00114
00115 SO_KIT_CATALOG_ENTRY_HEADER(multFactorSep) ;
00116 SO_KIT_CATALOG_ENTRY_HEADER(multFactorApp) ;
00117 SO_KIT_CATALOG_ENTRY_HEADER(multFactor) ;
00118
00119 SO_KIT_CATALOG_ENTRY_HEADER(decadeTextSep) ;
00120 SO_KIT_CATALOG_ENTRY_HEADER(decadeTextApp) ;
00121 SO_KIT_CATALOG_ENTRY_HEADER(decadeText) ;
00122
00123
00124 public:
00125
00129 enum DecadeListDef {
00133 DECADE_LIST_AUTO,
00137 DECADE_LIST_NON_AUTO
00138 } ;
00139
00143 enum TenPowGradRep {
00147 TEN_POWER_POW10,
00151 TEN_POWER_DECIMAL,
00155 TEN_POWER_AUTO
00160 } ;
00161
00165 enum DecadeRep {
00169 DECADE_NONE,
00173 DECADE_AS_TEN_POWER,
00177 DECADE_DECIMAL,
00181 DECADE_DIGIT,
00189 DECADE_AUTO
00194 } ;
00195
00199 enum MultFactorPosition {
00203 MULT_FACTOR_START,
00207 MULT_FACTOR_END,
00211 MULT_FACTOR_EXTR,
00215 MULT_FACTOR_GRAD
00216 } ;
00217
00218
00219
00220
00221
00228 SoMFUShort decadeList ;
00229
00234 SoSFEnum decadeListDef ;
00235
00240 SoSFEnum tenPowerRep ;
00241
00246 SoSFEnum decadeRep ;
00247
00252 SoSFString decadeFontName ;
00253
00259 SoSFFloat decadeFontSize ;
00260
00264 SoSFEnum multFactorPosition ;
00265
00272 SoSFFloat multFactorDistAxis ;
00273
00288 SoSFUShort maxGradNum;
00289
00293 PoLogAxis()
00294 { init(TRUE, SbVec3f(0.,0.,0.), 1, XY, DECADE_LIST_AUTO, NULL, 0, 0.0,0.0) ; }
00295
00300 PoLogAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type,
00301 DecadeListDef _decadeListDef = DECADE_LIST_AUTO,
00302 const unsigned short *_decadeList = NULL, short _numDecade = 0)
00303 { init(FALSE, _start, _end, _type, _decadeListDef, _decadeList, _numDecade, 0.0,0.0) ; }
00304
00310 PoLogAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type,
00311 float _gradStart, float _gradEnd,
00312 DecadeListDef _decadeListDef = DECADE_LIST_AUTO,
00313 const unsigned short *_decadeList = NULL, short _numDecade = 0)
00314 { init(FALSE, _start, _end, _type, _decadeListDef, _decadeList, _numDecade, _gradStart, _gradEnd) ; }
00315
00316
00317
00321 virtual void rebuild() ;
00322
00328 void getLogGrad(unsigned short &numDecade, unsigned short decadeList[8],
00329 TenPowGradRep &tenPowerRep, DecadeRep &decadeRep,
00330 SbString &decadeFontName, float &decadeFontSize) const ;
00331
00337 void getMultFactor(MultFactorPosition &position, float &distAxis) const ;
00338
00339
00340
00341
00342 private:
00343 static void initClass() ;
00344 static void exitClass() ;
00345
00346 struct MultFactor {
00347 MultFactorPosition position ;
00348 float distAxis ;
00349 } ;
00350
00351 struct Decade {
00352 DecadeRep rep ;
00353 DecadeListDef listDef ;
00354 int *values ;
00355 size_t number ;
00356 SbString fontName ;
00357 float fontSize ;
00358 } ;
00359
00360 private:
00361 struct LogAxisAttr {
00362 MultFactor multFactor ;
00363 TenPowGradRep tenPowerRep ;
00364 Decade decadeGrad ;
00365
00366
00367
00368 double firstAxisCoord;
00369 double lastAxisCoord;
00370 } ;
00371
00372
00373
00374
00375 virtual ~PoLogAxis() ;
00376 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00377 virtual void setDefaultOnNonWritingFields() ;
00378
00379
00380 virtual void saveAxisAttr() ;
00381
00382 private:
00383
00384
00385
00386 void init(SbBool isDefault, const SbVec3f &start, float end, Type typeAxis,
00387 DecadeListDef decadeListDef, const unsigned short *decadeList,
00388 short numDecade,float _gradStart, float _gradEnd) ;
00389
00390 void getLogGrads(float firstVal, float lastVal, float &stepValue, float &firstMainValue, size_t &numMainGrad);
00391
00392
00393
00394
00395
00396
00397
00398 double getGradCoord(double gradValue) const;
00399
00400
00401
00402 double getGradValue(double coord) const;
00403
00404
00405
00406 void buildLogGrad(std::vector<float> &mainGradX, std::vector<SecondaryLogGrad> &subGraduations,
00407 float stepValue, SoGroup *mainGroup, SoGroup *secondaryGroup) ;
00408
00409
00410 void computeLogGradFontSize(size_t numMainGrad, float stepValue, const char **main_str,
00411 const char **main_ten_pow_str, size_t numSecdGrad,
00412 const char **secd_str, const char **secd_ten_pow_str,
00413 float min_grad_dist, SbBool main_grad_pres_auto,
00414 float &main_font_size, float &secd_font_size) ;
00415
00416
00417 LogAxisAttr logAxisAttr ;
00418
00419
00420 FieldSensorList fieldSensorList ;
00421
00422
00423 SoFieldList fieldList ;
00424
00425 } ;
00426
00427
00428
00429 #endif
00430
00431
00432