1 /***********************************************************************/ 2 /* Open Visualization Data Explorer */ 3 /* (C) Copyright IBM Corp. 1989,1999 */ 4 /* ALL RIGHTS RESERVED */ 5 /* This code licensed under the */ 6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ 7 /***********************************************************************/ 8 9 #include <dxconfig.h> 10 #include "../base/defines.h" 11 12 13 14 15 #ifndef _LocalAttributes_h 16 #define _LocalAttributes_h 17 18 19 #include "Base.h" 20 21 22 // 23 // Class name definition: 24 // 25 #define ClassLocalAttributes "LocalAttributes" 26 27 28 // 29 // Describes local attributes for a component of a scalar 30 // Currently, we only support a local delta value. 31 // 32 class LocalAttributes : public Base { 33 friend class InteractorNode; 34 friend class ScalarNode; 35 friend class ScalarInstance; 36 friend class ScalarListInstance; 37 38 39 private: 40 41 protected: 42 43 boolean integerTyped; 44 boolean usingLocalDelta; // Are we using the local delta value 45 double currentValue; 46 double delta; 47 setValue(double val)48 void setValue(double val) { this->currentValue = val; } 49 useLocalDelta(double delta)50 void useLocalDelta(double delta) 51 { this->usingLocalDelta = TRUE; this->setDelta(delta); } 52 setDelta(double delta)53 void setDelta(double delta) { this->delta = delta; } 54 clrLocalDelta()55 void clrLocalDelta() { this->usingLocalDelta = FALSE; } 56 57 public: LocalAttributes(boolean isInteger)58 LocalAttributes(boolean isInteger) 59 { 60 this->integerTyped = isInteger; 61 this->delta = 1.00; 62 this->currentValue = 0.0; 63 this->usingLocalDelta = FALSE; 64 } 65 ~LocalAttributes()66 ~LocalAttributes() { } 67 68 isLocalDelta()69 boolean isLocalDelta() { return usingLocalDelta; } 70 71 #define ROUND(x) \ 72 ( (double) ((x > 0.0) ? (int)(x + .5) : (int)(x - .5) ) ) 73 getValue()74 double getValue() 75 { return (this->integerTyped ? 76 ROUND(this->currentValue) : this->currentValue); } 77 getDelta()78 double getDelta() 79 { return (this->integerTyped ? 80 ROUND(this->delta) : this->delta); } 81 #undef ROUND 82 getClassName()83 const char *getClassName() 84 { return ClassLocalAttributes; } 85 86 }; 87 88 #endif // _LocalAttributes_h 89 90