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_LINEAR_AXIS_
00025 #define _PO_LINEAR_AXIS_
00026
00027
00028 #include <Inventor/fields/SoSFEnum.h>
00029 #include <Inventor/fields/SoSFFloat.h>
00030
00031
00032 #include <MeshViz/graph/PoCartesianAxis.h>
00033 #include <MeshViz/graph/PiNumericFormat.h>
00034 #include <MeshViz/graph/PbNumericDisplayFormat.h>
00035
00126 class PoLinearAxis : public PoCartesianAxis {
00127
00128 SO_KIT_HEADER(PoLinearAxis) ;
00129
00130
00131 SO_KIT_CATALOG_ENTRY_HEADER(multFactorSep) ;
00132 SO_KIT_CATALOG_ENTRY_HEADER(multFactorApp) ;
00133 SO_KIT_CATALOG_ENTRY_HEADER(multFactor) ;
00134
00135
00136 public:
00137
00141 enum GradFit {
00145 GRAD_FIT,
00149 GRAD_UNFIT
00150 } ;
00151
00152 enum MultFactorPosition {
00156 MULT_FACTOR_START,
00160 MULT_FACTOR_END,
00164 MULT_FACTOR_EXTR,
00168 MULT_FACTOR_GRAD
00169 } ;
00170
00171
00172
00173
00174
00179 SoSFFloat step ;
00180
00184 SoSFEnum gradFit ;
00185
00186
00187
00191 SoSFEnum multFactorPosition ;
00192
00199 SoSFFloat multFactorDistAxis ;
00200
00201
00202
00206 PoLinearAxis()
00207 { init(SbVec3f(0.,0.,0.), 1., XY, 0.0,0.0, 0.) ; }
00208
00212 PoLinearAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type, float _step = 0.0)
00213 { init(_start, _end, _type, 0.0,0.0, _step) ; }
00214
00219 PoLinearAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type,
00220 float _gradStart, float _gradEnd, float _step = 0.0)
00221 { init(_start, _end, _type, _gradStart, _gradEnd,_step) ; }
00222
00226 virtual void rebuild() ;
00227
00235 void setFormat(PbNumericDisplayFormat *format) ;
00236
00241 const PbNumericDisplayFormat *getFormat() const ;
00242
00247 float getStep() const ;
00248
00254 void getMultFactor(MultFactorPosition &position, float &distAxis) const ;
00255
00256
00257 private:
00258
00259 static void initClass() ;
00260 static void exitClass() ;
00261
00262
00263
00264
00265 static void getLinGradStep(float deltaValue, float &requestStep) ;
00266
00267
00268
00269
00270 static void getLinGradFirstGrad(GradFit fit, float firstVal,
00271 float lastVal, float step, float &firstGrad,
00272 size_t &numGrad) ;
00273
00274
00275 static void getLinGrads(GradFit fit, float firstVal, float lastVal,
00276 float &requestStep, float &firstGrad, size_t &numGrad) ;
00277
00278 struct MultFactor {
00279 MultFactorPosition position ;
00280 float distAxis ;
00281 } ;
00282
00283 private:
00284
00285
00286 struct LinAxisAttr {
00287 MultFactor multFactor ;
00288 PiNumericFormat numericFormat ;
00289
00290 float step ;
00291
00292 float firstVal ;
00293
00294
00295
00296 double firstAxisCoord;
00297 double lastAxisCoord;
00298 } ;
00299
00300
00301
00302 virtual ~PoLinearAxis() ;
00303 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00304 virtual void setDefaultOnNonWritingFields() ;
00305
00306
00307 virtual void basicObjectChange(PbBase *basicObj) ;
00308
00309
00310 virtual void saveAxisAttr() ;
00311
00312
00313 virtual void addElementsAllCaches() ;
00314 virtual void preRebuild() ;
00315
00316 private:
00317
00318 void init(const SbVec3f &start, float end, Type typeAxis, float _gradStart, float _gradEnd, float s = 0.0) ;
00319
00320
00321
00322
00323
00324
00325
00326 double getGradCoord(double gradValue) const;
00327
00328
00329
00330 double getGradValue(double coord) const;
00331
00332
00333 PbNumericDisplayFormat *m_numericDisplayFormat, m_defaultNumericDisplayFormat ;
00334
00335
00336 LinAxisAttr linAxisAttr ;
00337
00338
00339 FieldSensorList fieldSensorList ;
00340
00341
00342 SoFieldList fieldList ;
00343
00344 } ;
00345
00346
00347
00348 #endif
00349
00350
00351