ML Reference
|
00001 // **InsertLicense** code 00002 //------------------------------------------------------------------------- 00012 //------------------------------------------------------------------------- 00013 #ifndef __mlFields_H 00014 #define __mlFields_H 00015 00016 // ML-includes 00017 #ifndef __mlInitSystemML_H 00018 #include "mlInitSystemML.h" 00019 #endif 00020 #ifndef __mlBasics_H 00021 #include "mlBasics.h" 00022 #endif 00023 #ifndef __mlField_H 00024 #include "mlField.h" 00025 #endif 00026 #ifndef __mlRuntimeSubClass_H 00027 #include "mlRuntimeSubClass.h" 00028 #endif 00029 00030 #include "mlPlane.h" 00031 #include "mlRotation.h" 00032 #include "mlSubImageBoxd.h" 00033 #include "mlRefCountedBase.h" 00034 00036 // Inventor Nodes 00037 class SoNode; 00038 00040 00041 00042 ML_START_NAMESPACE 00043 00044 #ifdef ML_DEPRECATED 00045 #define ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER ML_DEPRECATED 00046 #endif 00047 00049 class Module; 00050 class OutputConnector; 00051 class InputConnector; 00053 00054 //------------------------------------------------------------------------- 00056 //------------------------------------------------------------------------- 00057 MLEXPORT void MLInitFields(); 00058 00059 //------------------------------------------------------------------------- 00062 //------------------------------------------------------------------------- 00063 class MLEXPORT BoolField : public Field 00064 { 00066 ML_CLASS_HEADER(BoolField); 00067 00068 00069 public: 00070 00072 BoolField(); 00073 00076 BoolField(const std::string& name); 00077 00079 void setStringValue(const std::string& value); 00080 00082 void setBoolValue(bool boolValue); 00083 00085 void toggleValue(); 00086 00088 std::string getStringValue() const; 00089 00091 bool getBoolValue() const; 00092 00094 bool isOn() const; 00095 00096 protected: 00097 00099 virtual void setValueFromField(const Field& field); 00100 00101 private: 00102 00104 bool* _valuePtr; 00105 00107 bool _internalValue; 00108 00110 void _initialize(const std::string& name="", bool* valuePtr=NULL); 00111 00112 #ifdef ML_DEPRECATED 00113 00115 00116 00117 public: 00118 00121 inline ML_DEPRECATED void switch_Value() { toggleValue(); } 00123 00124 #endif // ML_DEPRECATED 00125 00126 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00127 00129 00130 00131 public: 00132 00135 BoolField(const std::string &name, bool *valuePtr); 00136 00138 00139 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00140 00141 00142 }; 00143 00144 00145 //------------------------------------------------------------------------- 00148 //------------------------------------------------------------------------- 00149 class MLEXPORT IntField : public Field 00150 { 00152 ML_CLASS_HEADER(IntField); 00153 00154 public: 00155 00157 IntField(); 00158 00161 IntField(const std::string& name); 00162 00164 void setStringValue(const std::string& value); 00165 00167 void setIntValue(MLint intValue); 00168 00172 std::string getStringValue() const; 00173 00175 MLint getIntValue() const; 00176 00177 protected: 00178 00180 virtual void setValueFromField(const Field& field); 00181 00182 private: 00183 00185 MLintPtr _valuePtr; 00186 00188 MLint _internalValue; 00189 00191 void _initialize(const std::string& name="", MLintPtr valuePtr=NULL); 00192 00195 MLint _minValue; 00198 MLint _maxValue; 00199 00200 #ifdef ML_DEPRECATED 00201 00203 00204 00205 public: 00206 00209 ML_DEPRECATED void setIntMaxValue(MLint maxValue); 00212 ML_DEPRECATED MLint getIntMaxValue() const; 00215 ML_DEPRECATED void setIntMinValue(MLint minValue); 00218 ML_DEPRECATED MLint getIntMinValue() const; 00220 00221 #endif // ML_DEPRECATED 00222 00223 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00224 00226 00227 00228 public: 00229 00232 IntField(const std::string &name, MLintPtr valuePtr); 00233 00235 00236 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00237 00238 }; 00239 00240 #ifdef ML_DEPRECATED 00241 //------------------------------------------------------------------------- 00245 //------------------------------------------------------------------------- 00246 class MLEXPORT ML_DEPRECATED ToggleField : public Field 00247 { 00249 ML_CLASS_HEADER(ToggleField); 00250 00251 public: 00252 00254 ToggleField(); 00255 00260 ToggleField(const std::string& name); 00261 00263 void setStringValue(const std::string& value); 00264 00266 void setIntValue(int intValue); 00267 00269 void setToggleValue(bool b); 00270 00273 void toggleValue(); 00274 00277 std::string getStringValue() const; 00278 00280 int getIntValue() const; 00281 00283 bool isOn() const; 00284 00285 protected: 00286 00288 virtual void setValueFromField(const Field& field); 00289 00290 private: 00291 00293 int* _valuePtr; 00294 00296 int _internalValue; 00297 00299 void _initialize(const std::string& name="", int* valuePtr=NULL); 00300 00301 #ifdef ML_DEPRECATED 00302 00304 00305 00306 public: 00307 00310 ML_DEPRECATED void switch_Value(); 00312 00313 #endif // ML_DEPRECATED 00314 00315 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00316 00318 00319 00320 public: 00321 00324 ToggleField(const std::string &name, int* valuePtr); 00325 00327 00328 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00329 00330 }; 00331 00332 #endif // ML_DEPRECATED 00333 00334 //------------------------------------------------------------------------- 00337 //------------------------------------------------------------------------- 00338 class MLEXPORT EnumField : public Field 00339 { 00341 ML_CLASS_HEADER(EnumField); 00342 00343 public: 00344 00346 EnumField(); 00348 EnumField(const std::string& name); 00349 00357 EnumField(const std::string& name, const std::string enumerationItemNames[], size_t numEnumerationItems); 00358 00366 EnumField(const std::string& name, const char* const* enumerationItemNames, size_t numEnumerationItems); 00367 00375 EnumField(const std::string& name, const std::vector<std::string> &enumerationItemNames); 00376 00378 virtual ~EnumField(); 00379 00383 void setStringValue(const std::string& value); 00384 00387 void setStringValueDefaulted(const std::string& value, int defaultItem); 00388 00390 void setEnumValue(int index); 00391 00395 std::string getStringValue() const; 00396 00401 const char* getStringValue(size_t index) const; 00402 00404 int getEnumValue() const; 00405 00407 size_t getNumEnumerationItems() const; 00408 00410 virtual MLint isValidValue(); 00411 00412 private: 00413 00415 void _initialize(const std::string& name="", size_t numEnums=0, int* valuePtr=NULL); 00416 00418 void _setEnumerationNames(const std::string enumNames[]); 00420 void _setEnumerationNames(const char* const* enumNames); 00422 void _setEnumerationNames(const std::vector<std::string> &enumNames); 00423 00426 int* _valuePtr; 00427 00429 int _internalValue; 00430 00431 00433 size_t _enumNum; 00434 00436 char** _enumNames; 00437 00438 00439 #ifdef ML_DEPRECATED 00440 00442 00443 00444 public: 00445 00448 inline ML_DEPRECATED size_t getEnumNum() const { return getNumEnumerationItems(); } 00449 00451 00452 #endif // ML_DEPRECATED 00453 00454 00455 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00456 00458 00459 00460 public: 00461 00464 EnumField(const std::string &name, const std::string enumNames[], size_t enumNum, int *valuePtr); 00465 00468 EnumField(const std::string &name, const char* const* enumNames, size_t enumNum, int *valuePtr); 00469 00471 00472 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00473 00474 }; 00475 00476 00477 //------------------------------------------------------------------------- 00480 //------------------------------------------------------------------------- 00481 class MLEXPORT FloatField : public Field 00482 { 00484 ML_CLASS_HEADER(FloatField); 00485 00486 public: 00487 00489 FloatField(); 00490 00493 FloatField(const std::string& name); 00494 00496 void setStringValue(const std::string& stringValue); 00497 00500 void setFloatValue(float floatValue); 00501 00504 std::string getStringValue() const; 00505 00507 float getFloatValue() const; 00508 00509 protected: 00511 virtual void setValueFromField(const Field& field); 00512 00514 void _initialize(const std::string& name="", float* valuePtr=NULL); 00515 00516 00518 float* _valuePtr; 00519 00521 float _internalValue; 00522 00525 float _minValue; 00528 float _maxValue; 00529 00530 #ifdef ML_DEPRECATED 00531 00533 00534 00535 public: 00536 00539 ML_DEPRECATED void setFloatMaxValue(float maxValue); 00542 ML_DEPRECATED float getFloatMaxValue() const; 00545 ML_DEPRECATED void setFloatMinValue(float minValue); 00548 ML_DEPRECATED float getFloatMinValue() const; 00549 00551 00552 #endif // ML_DEPRECATED 00553 00554 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00555 00557 00558 00559 public: 00560 00563 FloatField(const std::string& name, float *valuePtr); 00564 00566 00567 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00568 00569 00570 }; 00571 00572 00573 //------------------------------------------------------------------------- 00579 //------------------------------------------------------------------------- 00580 class MLEXPORT ProgressField : public FloatField 00581 { 00583 ML_CLASS_HEADER(ProgressField); 00584 00585 public: 00586 00588 ProgressField(); 00589 00594 ProgressField(const std::string& name); 00595 00598 void setFloatValue(float floatValue); 00599 00601 void setProgressValue(float floatValue); 00602 00604 inline float getProgressValue() { return getFloatValue(); } 00605 00608 void setUpdateDifference(float epsilonValue); 00609 00610 private: 00612 float _difference; 00613 00615 void _initialize(); 00616 00617 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00618 00620 00621 00622 public: 00623 00626 ProgressField(const std::string& name, float *valuePtr); 00627 00629 00630 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00631 00632 }; 00633 00634 00635 //------------------------------------------------------------------------- 00638 //------------------------------------------------------------------------- 00639 class MLEXPORT DoubleField : public Field 00640 { 00642 ML_CLASS_HEADER(DoubleField); 00643 00644 00645 public: 00646 00648 DoubleField(); 00649 00652 DoubleField(const std::string& name); 00653 00655 void setStringValue(const std::string& stringValue); 00656 00658 void setDoubleValue(double doubleValue); 00659 00662 std::string getStringValue() const; 00663 00665 double getDoubleValue() const; 00666 00667 protected: 00669 virtual void setValueFromField(const Field& field); 00670 00671 private: 00673 double* _valuePtr; 00674 00676 double _internalValue; 00677 00679 void _initialize(const std::string& name="", double* valuePtr=NULL); 00680 00683 double _minValue; 00686 double _maxValue; 00687 00688 #ifdef ML_DEPRECATED 00689 00691 00692 00693 public: 00694 00697 ML_DEPRECATED void setDoubleMaxValue(double maxValue); 00700 ML_DEPRECATED double getDoubleMaxValue() const; 00703 ML_DEPRECATED void setDoubleMinValue(double minValue); 00706 ML_DEPRECATED double getDoubleMinValue() const; 00707 00709 00710 #endif // ML_DEPRECATED 00711 00712 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00713 00715 00716 00717 public: 00718 00721 DoubleField(const std::string& name, double *valuePtr); 00722 00724 00725 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 00726 00727 }; 00728 00729 00730 //------------------------------------------------------------------------- 00733 //------------------------------------------------------------------------- 00734 class MLEXPORT LongDoubleField : public Field 00735 { 00737 ML_CLASS_HEADER(LongDoubleField); 00738 00739 00740 public: 00741 00742 // Default constructor, do not use it. 00743 LongDoubleField(); 00744 00747 LongDoubleField(const std::string& name); 00748 00750 void setStringValue(const std::string& stringValue); 00751 00754 void setLongDoubleValue(MLldouble longDoubleValue); 00755 00758 std::string getStringValue() const; 00759 00761 MLldouble getLongDoubleValue() const; 00762 00763 protected: 00765 virtual void setValueFromField(const Field& field); 00766 00767 private: 00769 MLldouble _value; 00770 00772 void _initialize(const std::string& name=""); 00773 00776 MLldouble _minValue; 00779 MLldouble _maxValue; 00780 00781 #ifdef ML_DEPRECATED 00782 00784 00785 00786 public: 00787 00790 ML_DEPRECATED void setLongDoubleMaxValue(MLldouble maxValue); 00793 ML_DEPRECATED MLldouble getLongDoubleMaxValue() const; 00796 ML_DEPRECATED void setLongDoubleMinValue(MLldouble minValue); 00799 ML_DEPRECATED MLldouble getLongDoubleMinValue() const; 00801 00802 #endif // ML_DEPRECATED 00803 }; 00804 00805 00806 //------------------------------------------------------------------------- 00809 //------------------------------------------------------------------------- 00810 class MLEXPORT StringField : public Field 00811 { 00813 ML_CLASS_HEADER(StringField); 00814 00815 00816 public: 00817 00819 StringField(); 00820 00823 StringField(const std::string& name); 00824 00826 void setStringValue(const std::string& stringValue); 00827 00830 std::string getStringValue() const; 00831 00832 private: 00835 std::string _value; 00836 00838 void _initialize(const std::string& name=""); 00839 }; 00840 00841 00842 //------------------------------------------------------------------------- 00845 //------------------------------------------------------------------------- 00846 class MLEXPORT NotifyField : public Field 00847 { 00849 ML_CLASS_HEADER(NotifyField); 00850 00851 public: 00852 00854 NotifyField(); 00855 00859 NotifyField(const std::string& name); 00860 00863 void setStringValue(const std::string& /*value*/); 00864 00866 std::string getStringValue() const; 00867 00869 void notify(); 00870 00871 }; 00872 00873 00874 //------------------------------------------------------------------------- 00878 //------------------------------------------------------------------------- 00879 class MLEXPORT OutputConnectorField : public Field 00880 { 00882 ML_CLASS_HEADER(OutputConnectorField); 00883 00884 public: 00885 00887 OutputConnectorField(); 00888 00891 OutputConnectorField(const std::string& name, Module* module, MLint outputImageIndex); 00892 00894 virtual ~OutputConnectorField(); 00895 00899 void setStringValue(const std::string& /*value*/); 00900 00904 virtual void touch(FieldSensor::Strength strength=FieldSensor::CHANGED); 00905 00910 std::string getStringValue() const; 00911 00913 OutputConnector& getOutputConnectorValue() const; 00914 00916 virtual MLint isValidValue(); 00917 00918 00919 private: 00920 00922 OutputConnector* _valuePtr; 00923 00925 void _initialize(); 00926 }; 00927 00928 00929 //------------------------------------------------------------------------- 00933 //------------------------------------------------------------------------- 00934 class MLEXPORT InputConnectorField : public Field 00935 { 00937 ML_CLASS_HEADER(InputConnectorField); 00938 00939 public: 00940 00942 InputConnectorField(); 00943 00948 InputConnectorField(const std::string& name, Module* module, MLint inputImageIndex); 00949 00951 virtual ~InputConnectorField(); 00952 00956 void setStringValue(const std::string& /*value*/); 00957 00960 std::string getStringValue() const; 00961 00963 InputConnector& getInputConnectorValue() const; 00964 00966 virtual MLint isValidValue(); 00967 00968 private: 00970 InputConnector* _valuePtr; 00971 00973 void _initialize(); 00974 }; 00975 00976 00977 //------------------------------------------------------------------------- 00980 //------------------------------------------------------------------------- 00981 class MLEXPORT BaseField : public Field 00982 { 00984 ML_CLASS_HEADER(BaseField); 00985 00986 public: 00987 00989 BaseField(); 00990 00993 BaseField(const std::string& name); 00994 00996 ~BaseField(); 00997 00999 void setStringValue(const std::string& stringValue); 01000 01002 void setBaseValue(Base* basePointerValue); 01003 01005 void setBaseValue(const RefCountedBasePtr& value); 01006 01010 std::string getStringValue() const; 01011 01013 Base* getBaseValue() const; 01014 01016 virtual void touchSourceFields (void); 01017 01023 void addAllowedType(const RuntimeType* allowedType); 01024 01026 template <typename T> 01027 void addAllowedType() { addAllowedType(T::getClassTypeId()); } 01028 01032 template <typename T> 01033 void setBaseValueAndAddAllowedType(T* value) { addAllowedType(value->getClassTypeId()); setBaseValue(value); } 01034 01037 template <typename T> 01038 void setBaseValueAndAddAllowedType(const ::boost::intrusive_ptr<T>& value) { setBaseValueAndAddAllowedType(value.get()); } 01039 01041 std::vector<const RuntimeType*> getAllowedTypes() const { return _allowedTypes; } 01042 01045 bool hasUnallowedType() const { return _unallowedType; } 01046 01047 protected: 01049 virtual void setValueFromField(const Field& field); 01050 01051 private: 01053 Base* _value; 01054 01056 std::vector<const RuntimeType*> _allowedTypes; 01057 01059 bool _unallowedType; 01061 bool _isRefCountedBase; 01062 01064 void _initialize(const std::string& name=""); 01065 01066 }; 01067 01068 01069 //------------------------------------------------------------------------- 01075 //------------------------------------------------------------------------- 01076 class MLEXPORT SoNodeField : public Field 01077 { 01079 ML_CLASS_HEADER(SoNodeField); 01080 01081 public: 01082 01084 SoNodeField(); 01085 01088 SoNodeField(const std::string& name); 01089 01091 void setStringValue(const std::string& stringValue); 01092 01094 void setSoNodeValue(SoNode* soNodeValue); 01095 01099 std::string getStringValue() const; 01100 01102 SoNode* getSoNodeValue() const; 01103 01104 protected: 01106 virtual void setValueFromField(const Field& field); 01107 01108 private: 01110 SoNode* _internalValue; 01111 01113 void _initialize(const std::string& name=""); 01114 }; 01115 01116 01117 //------------------------------------------------------------------------- 01124 //------------------------------------------------------------------------- 01125 class MLEXPORT PointerField : public Field 01126 { 01128 ML_CLASS_HEADER(PointerField); 01129 01130 public: 01131 01133 PointerField(); 01134 01137 PointerField(const std::string& name); 01138 01141 void setStringValue(const std::string& stringValue); 01142 01144 void setPointerValue(void* voidPointerValue); 01145 01148 std::string getStringValue() const; 01149 01151 void* getPointerValue() const; 01152 01153 private: 01155 void* _valuePtr; 01156 01158 void _initialize(const std::string& name=""); 01159 }; 01160 01161 //------------------------------------------------------------------------- 01164 //------------------------------------------------------------------------- 01165 class MLEXPORT Vector2Field : public Field 01166 { 01168 ML_CLASS_HEADER(Vector2Field); 01169 01170 public: 01171 01173 Vector2Field(); 01174 01177 Vector2Field(const std::string& name); 01178 01180 void setStringValue(const std::string& stringValue); 01181 01183 void setVector2Value(const Vector2& vectorValue); 01184 01186 inline void setVectorValue(const Vector2& vectorValue) { setVector2Value(vectorValue); } 01187 01189 std::string getStringValue() const; 01190 01192 const Vector2& getVector2Value() const; 01193 01195 inline const Vector2& getVectorValue() const { return getVector2Value(); } 01196 01197 protected: 01199 virtual void setValueFromField(const Field& field); 01200 01201 private: 01203 Vector2* _valuePtr; 01204 01206 Vector2 _internalValue; 01207 01209 void _initialize(const std::string& name="", Vector2* valuePtr=NULL); 01210 01211 01212 #ifdef ML_DEPRECATED 01213 01215 01216 01217 public: 01218 01221 inline ML_DEPRECATED void setVec2fValue(const Vector2& value) { setVector2Value(value); } 01224 inline ML_DEPRECATED const Vector2& getVec2fValue() const { return getVector2Value(); } 01225 01227 01228 #endif // ML_DEPRECATED 01229 01230 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01231 01233 01234 01235 public: 01236 01239 Vector2Field(const std::string& name, Vector2* valuePtr); 01240 01242 01243 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01244 01245 01246 }; 01247 01248 #ifdef ML_DEPRECATED 01249 01250 01251 01252 01253 ML_DEPRECATED typedef Vector2Field Vec2fField; 01255 #endif // ML_DEPRECATED 01256 01257 //------------------------------------------------------------------------- 01260 //------------------------------------------------------------------------- 01261 class MLEXPORT Vector3Field : public Field 01262 { 01264 ML_CLASS_HEADER(Vector3Field); 01265 01266 public: 01267 01269 Vector3Field(); 01270 01273 Vector3Field(const std::string& name); 01274 01276 void setStringValue(const std::string& stringValue); 01277 01279 void setVector3Value(const Vector3& vectorValue); 01280 01282 inline void setVectorValue(const Vector3& vectorValue) { setVector3Value(vectorValue); } 01283 01287 std::string getStringValue() const; 01288 01290 const Vector3& getVector3Value() const; 01291 01293 inline const Vector3& getVectorValue() const { return getVector3Value(); } 01294 01295 01296 protected: 01298 virtual void setValueFromField(const Field& field); 01299 01300 private: 01302 Vector3* _valuePtr; 01303 01305 Vector3 _internalValue; 01306 01308 void _initialize(const std::string& name="", Vector3* valuePtr=NULL); 01309 01310 01311 #ifdef ML_DEPRECATED 01312 01314 01315 01316 public: 01319 inline ML_DEPRECATED void setVec3fValue(const Vector3& value) { setVector3Value(value); } 01322 inline ML_DEPRECATED const Vector3& getVec3fValue() const { return getVector3Value(); } 01323 01325 01326 #endif // ML_DEPRECATED 01327 01328 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01329 01331 01332 01333 public: 01334 01337 Vector3Field(const std::string& name, Vector3* valuePtr); 01338 01340 01341 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01342 01343 }; 01344 01345 #ifdef ML_DEPRECATED 01346 01347 01348 01349 01350 ML_DEPRECATED typedef Vector3Field Vec3fField; 01352 #endif // ML_DEPRECATED 01353 01354 01355 //------------------------------------------------------------------------- 01358 //------------------------------------------------------------------------- 01359 class MLEXPORT Vector4Field : public Field 01360 { 01362 ML_CLASS_HEADER(Vector4Field); 01363 01364 public: 01365 01367 Vector4Field(); 01368 01371 Vector4Field(const std::string& name); 01372 01374 void setStringValue(const std::string& stringValue); 01375 01377 void setVector4Value(const Vector4& vectorValue); 01378 01380 inline void setVectorValue(const Vector4& vectorValue) { setVector4Value(vectorValue); } 01381 01382 01386 std::string getStringValue() const; 01387 01389 const Vector4& getVector4Value() const; 01390 01392 inline const Vector4& getVectorValue() const { return getVector4Value(); } 01393 01394 protected: 01396 virtual void setValueFromField(const Field& field); 01397 01398 private: 01400 Vector4* _valuePtr; 01401 01403 Vector4 _internalValue; 01404 01406 void _initialize(const std::string& name="", Vector4* valuePtr=NULL); 01407 01408 01409 #ifdef ML_DEPRECATED 01410 01412 01413 01414 public: 01417 inline ML_DEPRECATED void setVec4fValue(const Vector4& value) { setVector4Value(value); } 01420 inline ML_DEPRECATED const Vector4& getVec4fValue() const { return getVector4Value(); } 01421 01423 01424 #endif // ML_DEPRECATED 01425 01426 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01427 01429 01430 01431 public: 01432 01435 Vector4Field(const std::string& name, Vector4* valuePtr); 01436 01438 01439 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01440 01441 }; 01442 01443 #ifdef ML_DEPRECATED 01444 01445 01446 01447 01448 ML_DEPRECATED typedef Vector4Field Vec4fField; 01450 #endif // ML_DEPRECATED 01451 01452 01453 //------------------------------------------------------------------------- 01456 //------------------------------------------------------------------------- 01457 class MLEXPORT Vector5Field : public Field 01458 { 01460 ML_CLASS_HEADER(Vector5Field); 01461 01462 01463 public: 01464 01466 Vector5Field(); 01467 01470 Vector5Field(const std::string& name); 01471 01473 void setStringValue(const std::string& stringValue); 01474 01476 void setVector5Value(const Vector5& vectorValue); 01477 01479 inline void setVectorValue(const Vector5& vectorValue) { setVector5Value(vectorValue); } 01480 01484 std::string getStringValue() const; 01485 01487 const Vector5& getVector5Value() const; 01488 01490 inline const Vector5& getVectorValue() const { return getVector5Value(); } 01491 01492 01493 protected: 01495 virtual void setValueFromField(const Field& field); 01496 01497 private: 01499 Vector5 _value; 01500 01502 void _initialize(const std::string& name=""); 01503 01504 01505 #ifdef ML_DEPRECATED 01506 01508 01509 01510 public: 01511 01514 inline ML_DEPRECATED void setVec5fValue(const Vector5& value) { setVector5Value(value); } 01517 inline ML_DEPRECATED const Vector5& getVec5fValue() const { return getVector5Value(); } 01518 01520 01521 #endif // ML_DEPRECATED 01522 01523 }; 01524 01525 #ifdef ML_DEPRECATED 01526 01527 01528 01529 01530 ML_DEPRECATED typedef Vector5Field Vec5fField; 01532 #endif // ML_DEPRECATED 01533 01534 01535 //------------------------------------------------------------------------- 01538 //------------------------------------------------------------------------- 01539 class MLEXPORT Vector6Field : public Field 01540 { 01542 ML_CLASS_HEADER(Vector6Field); 01543 01544 01545 public: 01546 01548 Vector6Field(); 01549 01552 Vector6Field(const std::string& name); 01553 01555 void setStringValue(const std::string& stringValue); 01556 01558 void setVector6Value(const Vector6& vectorValue); 01559 01561 inline void setVectorValue(const Vector6& vectorValue) { setVector6Value(vectorValue); } 01562 01566 std::string getStringValue() const; 01567 01569 const Vector6& getVector6Value() const; 01570 01572 inline const Vector6& getVectorValue() const { return getVector6Value(); } 01573 01574 01575 protected: 01577 virtual void setValueFromField(const Field& field); 01578 01579 private: 01581 Vector6* _valuePtr; 01582 01584 Vector6 _internalValue; 01585 01587 void _initialize(const std::string& name="", Vector6* valuePtr=NULL); 01588 01589 #ifdef ML_DEPRECATED 01590 01592 01593 01594 public: 01595 01598 inline ML_DEPRECATED void setVec6fValue(const Vector6& value) { setVector6Value(value); } 01601 inline ML_DEPRECATED const Vector6& getVec6fValue() const { return getVector6Value(); } 01602 01604 01605 #endif // ML_DEPRECATED 01606 01607 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01608 01610 01611 01612 public: 01613 01616 Vector6Field(const std::string& name, Vector6* valuePtr); 01617 01619 01620 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01621 01622 }; 01623 01624 #ifdef ML_DEPRECATED 01625 01626 01627 01628 01629 ML_DEPRECATED typedef Vector6Field Vec6fField; 01631 #endif // ML_DEPRECATED 01632 01633 01634 //------------------------------------------------------------------------- 01637 //------------------------------------------------------------------------- 01638 class MLEXPORT Vector10Field : public Field 01639 { 01641 ML_CLASS_HEADER(Vector10Field); 01642 01643 01644 public: 01645 01647 Vector10Field(); 01648 01651 Vector10Field(const std::string& name); 01652 01654 void setStringValue(const std::string& stringValue); 01655 01657 void setVector10Value(const Vector10& vectorValue); 01658 01660 inline void setVectorValue(const Vector10& vectorValue) { setVector10Value(vectorValue); } 01661 01662 01666 std::string getStringValue() const; 01667 01669 const Vector10& getVector10Value() const; 01670 01672 inline const Vector10& getVectorValue() const { return getVector10Value(); } 01673 01674 01675 protected: 01677 virtual void setValueFromField(const Field& field); 01678 01679 private: 01681 Vector10 _value; 01682 01684 void _initialize(const std::string& name=""); 01685 01686 #ifdef ML_DEPRECATED 01687 01689 01690 01691 public: 01692 01695 inline ML_DEPRECATED void setVec10fValue(const Vector10& value) { setVector10Value(value); } 01698 inline ML_DEPRECATED const Vector10& getVec10fValue() const { return getVector10Value(); } 01699 01701 01702 #endif // ML_DEPRECATED 01703 }; 01704 01705 #ifdef ML_DEPRECATED 01706 01707 01708 01709 01710 ML_DEPRECATED typedef Vector10Field Vec10fField; 01712 #endif // ML_DEPRECATED 01713 01714 01715 //------------------------------------------------------------------------- 01720 //------------------------------------------------------------------------- 01721 class MLEXPORT ColorField : public Vector3Field 01722 { 01724 ML_CLASS_HEADER(ColorField); 01725 01726 public: 01727 01729 ColorField(); 01730 01734 ColorField(const std::string& name); 01735 01737 void setColorValue(float r, float g, float b); 01738 01740 void getColorValue(float& r, float& g, float& b) const; 01741 01746 void setPackedColorValue(MLuint32 rgba); 01747 01751 MLuint32 getPackedColorValue() const; 01752 01753 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01754 01756 01757 01758 public: 01759 01762 ColorField(const std::string& name, Vector3* valuePtr); 01763 01765 01766 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 01767 01768 }; 01769 01770 01771 //------------------------------------------------------------------------- 01774 //------------------------------------------------------------------------- 01775 class MLEXPORT Matrix2Field : public Field 01776 { 01778 ML_CLASS_HEADER(Matrix2Field); 01779 01780 public: 01783 Matrix2Field(const std::string& name=""); 01784 01788 void setStringValue(const std::string& stringValue); 01789 01791 void setMatrixValue(const Matrix2& matrixValue); 01792 01795 void setMatrix2Value(const Matrix2& matrixValue); 01796 01800 std::string getStringValue() const; 01801 01803 const Matrix2& getMatrixValue() const; 01804 01807 const Matrix2& getMatrix2Value() const; 01808 01809 protected: 01811 virtual void setValueFromField(const Field& field); 01812 01813 private: 01815 Matrix2 _value; 01816 01817 #ifdef ML_DEPRECATED 01818 01820 01821 01822 public: 01825 inline ML_DEPRECATED void setMat2fValue(const Matrix2& value) { setMatrix2Value(value); } 01828 inline ML_DEPRECATED void setMat2Value(const Matrix2& value) { setMatrix2Value(value); } 01831 inline ML_DEPRECATED const Matrix2& getMat2Value() const { return getMatrix2Value(); } 01832 01834 01835 #endif // ML_DEPRECATED 01836 }; 01837 01838 #ifdef ML_DEPRECATED 01839 01840 01841 01842 01843 ML_DEPRECATED typedef Matrix2Field Mat2Field; 01845 #endif // ML_DEPRECATED 01846 01847 01848 //------------------------------------------------------------------------- 01851 //------------------------------------------------------------------------- 01852 class MLEXPORT Matrix3Field : public Field 01853 { 01855 ML_CLASS_HEADER(Matrix3Field); 01856 01857 public: 01860 Matrix3Field(const std::string& name=""); 01861 01865 void setStringValue(const std::string& stringValue); 01866 01868 void setMatrixValue(const Matrix3& matrixValue); 01869 01872 void setMatrix3Value(const Matrix3& matrixValue); 01873 01877 std::string getStringValue() const; 01878 01880 const Matrix3& getMatrixValue() const; 01881 01884 const Matrix3& getMatrix3Value() const; 01885 01886 protected: 01888 virtual void setValueFromField(const Field& field); 01889 01890 private: 01892 Matrix3 _value; 01893 01894 #ifdef ML_DEPRECATED 01895 01897 01898 01899 public: 01902 inline ML_DEPRECATED void setMat3fValue(const Matrix3& value) { setMatrix3Value(value); } 01905 inline ML_DEPRECATED void setMat3Value(const Matrix3& value) { setMatrix3Value(value); } 01908 inline ML_DEPRECATED const Matrix3& getMat3Value() const { return getMatrix3Value(); } 01909 01911 01912 #endif // ML_DEPRECATED 01913 01914 }; 01915 01916 #ifdef ML_DEPRECATED 01917 01918 01919 01920 01921 ML_DEPRECATED typedef Matrix3Field Mat3Field; 01923 #endif // ML_DEPRECATED 01924 01925 01926 01927 //------------------------------------------------------------------------- 01931 //------------------------------------------------------------------------- 01932 class MLEXPORT MatrixField : public Field 01933 { 01935 ML_CLASS_HEADER(MatrixField); 01936 01937 public: 01938 01940 MatrixField(); 01941 01944 MatrixField(const std::string& name); 01945 01949 void setStringValue(const std::string& stringValue); 01950 01952 void setMatrixValue(const Matrix4& matrixValue); 01953 01956 void setMatrix4Value(const Matrix4& matrixValue); 01957 01961 std::string getStringValue() const; 01962 01964 const Matrix4& getMatrixValue() const; 01965 01968 const Matrix4& getMatrix4Value() const; 01969 01970 protected: 01972 virtual void setValueFromField(const Field& field); 01973 01974 private: 01976 Matrix4* _valuePtr; 01977 01979 Matrix4 _internalValue; 01980 01982 void _initialize(const std::string& name="", Matrix4* valuePtr=0); 01983 01984 #ifdef ML_DEPRECATED 01985 01987 01988 01989 public: 01992 inline ML_DEPRECATED void setMat4fValue(const Matrix4& value) { setMatrix4Value(value); } 01995 inline ML_DEPRECATED void setMat4Value(const Matrix4& value) { setMatrix4Value(value); } 01998 inline ML_DEPRECATED const Matrix4& getMat4Value() const { return getMatrix4Value(); } 01999 02001 02002 #endif // ML_DEPRECATED 02003 02004 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02005 02007 02008 02009 public: 02010 02013 MatrixField(const std::string& name, Matrix4* valuePtr); 02014 02016 02017 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02018 02019 }; 02020 02021 02022 //------------------------------------------------------------------------- 02025 //------------------------------------------------------------------------- 02026 class MLEXPORT Matrix4Field : public MatrixField 02027 { 02029 ML_CLASS_HEADER(Matrix4Field); 02030 02031 public: 02034 Matrix4Field(const std::string& name=""); 02035 }; 02036 02037 #ifdef ML_DEPRECATED 02038 02039 02040 02041 02042 ML_DEPRECATED typedef Matrix4Field Mat4Field; 02044 #endif // ML_DEPRECATED 02045 02046 02047 //------------------------------------------------------------------------- 02050 //------------------------------------------------------------------------- 02051 class MLEXPORT Matrix5Field : public Field 02052 { 02054 ML_CLASS_HEADER(Matrix5Field); 02055 02056 public: 02059 Matrix5Field(const std::string& name=""); 02060 02064 void setStringValue(const std::string& stringValue); 02065 02067 void setMatrixValue(const Matrix5& matrixValue); 02068 02071 void setMatrix5Value(const Matrix5& matrixValue); 02072 02076 std::string getStringValue() const; 02077 02079 const Matrix5& getMatrixValue() const; 02080 02083 const Matrix5& getMatrix5Value() const; 02084 02085 protected: 02087 virtual void setValueFromField(const Field& field); 02088 02089 private: 02091 Matrix5 _value; 02092 02093 02094 #ifdef ML_DEPRECATED 02095 02097 02098 02099 public: 02102 inline ML_DEPRECATED void setMat5fValue(const Matrix5& value) { setMatrix5Value(value); } 02105 inline ML_DEPRECATED void setMat5Value(const Matrix5& value) { setMatrix5Value(value); } 02108 inline ML_DEPRECATED const Matrix5& getMat5Value() const { return getMatrix5Value(); } 02109 02111 02112 #endif // ML_DEPRECATED 02113 02114 }; 02115 02116 #ifdef ML_DEPRECATED 02117 02118 02119 02120 02121 ML_DEPRECATED typedef Matrix5Field Mat5Field; 02123 #endif // ML_DEPRECATED 02124 02125 02126 02127 //------------------------------------------------------------------------- 02130 //------------------------------------------------------------------------- 02131 class MLEXPORT Matrix6Field : public Field 02132 { 02134 ML_CLASS_HEADER(Matrix6Field); 02135 02136 public: 02139 Matrix6Field(const std::string& name=""); 02140 02144 void setStringValue(const std::string& stringValue); 02145 02147 void setMatrixValue(const Matrix6& matrixValue); 02148 02151 void setMatrix6Value(const Matrix6& matrixValue); 02152 02156 std::string getStringValue() const; 02157 02159 const Matrix6& getMatrixValue() const; 02160 02163 const Matrix6& getMatrix6Value() const; 02164 02165 protected: 02167 virtual void setValueFromField(const Field& field); 02168 02169 private: 02171 Matrix6 _value; 02172 02173 02174 #ifdef ML_DEPRECATED 02175 02177 02178 02179 public: 02180 02183 inline ML_DEPRECATED void setMat6fValue(const Matrix6& value) { setMatrix6Value(value); } 02186 inline ML_DEPRECATED void setMat6Value(const Matrix6& value) { setMatrix6Value(value); } 02189 inline ML_DEPRECATED const Matrix6& getMat6Value() const { return getMatrix6Value(); } 02190 02192 02193 #endif // ML_DEPRECATED 02194 }; 02195 02196 #ifdef ML_DEPRECATED 02197 02198 02199 02200 02201 ML_DEPRECATED typedef Matrix6Field Mat6Field; 02203 #endif // ML_DEPRECATED 02204 02205 02206 02207 //------------------------------------------------------------------------- 02210 //------------------------------------------------------------------------- 02211 class MLEXPORT MLDataTypeField : public Field 02212 { 02214 ML_CLASS_HEADER(MLDataTypeField); 02215 02216 public: 02217 02219 MLDataTypeField(); 02220 02223 MLDataTypeField(const std::string& name); 02224 02226 void setStringValue(const std::string& stringValue); 02227 02229 void setMLDataTypeValue(MLDataType dataType); 02230 02234 std::string getStringValue() const; 02235 02237 MLDataType getMLDataTypeValue() const; 02238 02239 private: 02241 MLDataType* _valuePtr; 02243 MLDataType _internalValue; 02244 02246 void _initialize(const std::string& name="", MLDataType* valuePtr=NULL); 02247 02248 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02249 02251 02252 02253 public: 02254 02257 MLDataTypeField(const std::string& name, MLDataType* valuePtr); 02258 02260 02261 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02262 02263 }; 02264 02265 02266 //------------------------------------------------------------------------- 02270 //------------------------------------------------------------------------- 02271 class MLEXPORT ImageVectorField : public Field 02272 { 02274 ML_CLASS_HEADER(ImageVectorField); 02275 02276 public: 02277 02279 ImageVectorField(); 02280 02283 ImageVectorField(const std::string& name); 02284 02286 void setStringValue(const std::string& stringValue); 02287 02289 void setImageVectorValue(const ImageVector& imageVectorValue); 02290 02292 std::string getStringValue() const; 02293 02295 const ImageVector& getImageVectorValue() const; 02296 02297 protected: 02299 virtual void setValueFromField(const Field& field); 02300 02301 private: 02303 ImageVector* _valuePtr; 02304 02306 ImageVector _internalValue; 02307 02309 void _initialize(const std::string& name="", ImageVector* valuePtr=NULL); 02310 02311 #ifdef ML_DEPRECATED 02312 02314 02315 02316 public: 02317 02320 inline ML_DEPRECATED void setVectorValue(const ImageVector& value) { setImageVectorValue(value); } 02323 inline ML_DEPRECATED const ImageVector& getVectorValue() const { return getImageVectorValue(); } 02324 02326 02327 #endif // ML_DEPRECATED 02328 02329 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02330 02332 02333 02334 public: 02335 02338 ImageVectorField(const std::string& name, ImageVector* valuePtr); 02339 02341 02342 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02343 02344 }; 02345 02346 #ifdef ML_DEPRECATED 02347 02348 02349 02350 02351 ML_DEPRECATED typedef ImageVectorField VectorField; 02353 #endif // ML_DEPRECATED 02354 02355 02356 //------------------------------------------------------------------------- 02359 //------------------------------------------------------------------------- 02360 class MLEXPORT SubImageBoxField : public Field 02361 { 02363 ML_CLASS_HEADER(SubImageBoxField); 02364 02365 public: 02366 02368 SubImageBoxField(); 02369 02372 SubImageBoxField(const std::string& name); 02373 02375 void setStringValue(const std::string& stringValue); 02376 02378 void setSubImageBoxValue(const SubImageBox& subImageBoxValue); 02379 02383 std::string getStringValue() const; 02384 02386 const SubImageBox& getSubImageBoxValue() const; 02387 02388 protected: 02390 virtual void setValueFromField(const Field& field); 02391 02392 private: 02394 SubImageBox* _valuePtr; 02396 SubImageBox _internalValue; 02397 02399 void _initialize(const std::string& name="", SubImageBox* valuePtr=NULL); 02400 02401 #ifdef ML_DEPRECATED 02402 02404 02405 02406 public: 02409 inline ML_DEPRECATED void setSubImgBoxValue(const SubImageBox& value) { setSubImageBoxValue(value); } 02412 inline ML_DEPRECATED const SubImageBox& getSubImgBoxValue() const { return getSubImageBoxValue(); } 02413 02415 02416 #endif // ML_DEPRECATED 02417 02418 02419 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02420 02422 02423 02424 public: 02425 02428 SubImageBoxField(const std::string& name, SubImageBox* valuePtr); 02429 02431 02432 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02433 02434 02435 }; 02436 02437 #ifdef ML_DEPRECATED 02438 02439 02440 02441 02442 ML_DEPRECATED typedef SubImageBoxField SubImgBoxField; 02444 #endif // ML_DEPRECATED 02445 02446 02447 //------------------------------------------------------------------------- 02450 //------------------------------------------------------------------------- 02451 class MLEXPORT SubImageBoxdField : public Field 02452 { 02454 ML_CLASS_HEADER(SubImageBoxdField); 02455 02456 public: 02457 02459 SubImageBoxdField(); 02460 02463 SubImageBoxdField(const std::string& name); 02464 02466 void setStringValue(const std::string& stringValue); 02467 02469 void setSubImageBoxdValue(const SubImageBoxd& subImageBoxfValue); 02470 02474 std::string getStringValue() const; 02475 02477 const SubImageBoxd& getSubImageBoxdValue() const; 02478 02479 protected: 02481 virtual void setValueFromField(const Field& field); 02482 02483 private: 02485 SubImageBoxd* _valuePtr; 02486 02488 SubImageBoxd _internalValue; 02489 02491 void _initialize(const std::string& name="", SubImageBoxd* valuePtr=NULL); 02492 02493 #ifdef ML_DEPRECATED 02494 02496 02497 02498 public: 02499 02502 inline ML_DEPRECATED void setSubImgBoxValue(const SubImageBoxd& value) { setSubImageBoxdValue(value); } 02505 inline ML_DEPRECATED const SubImageBoxd& getSubImgBoxValue() const { return getSubImageBoxdValue(); } 02508 inline ML_DEPRECATED void setSubImgBoxfValue(const SubImageBoxd& value) { setSubImageBoxdValue(value); } 02511 inline ML_DEPRECATED const SubImageBoxd& getSubImgBoxfValue() const { return getSubImageBoxdValue(); } 02512 02514 02515 #endif // ML_DEPRECATED 02516 02517 02518 #ifdef ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02519 02521 02522 02523 public: 02524 02527 SubImageBoxdField(const std::string& name, SubImageBoxd* valuePtr); 02528 02530 02531 #endif // ML_DEPRECATED_FIELDS_WITH_VALUE_POINTER 02532 02533 }; 02534 02535 #ifdef ML_DEPRECATED 02536 02537 02538 02539 ML_DEPRECATED typedef SubImageBoxdField SubImgBoxfField; 02541 #endif // ML_DEPRECATED 02542 02543 02544 //------------------------------------------------------------------------- 02547 //------------------------------------------------------------------------- 02548 class MLEXPORT UniversalTypeField : public Field 02549 { 02551 ML_CLASS_HEADER(UniversalTypeField); 02552 02553 public: 02557 UniversalTypeField(const std::string& name="", MLDataType dt=-1); 02558 02560 ~UniversalTypeField(); 02561 02563 virtual MLint isValidValue(); 02564 02566 virtual void setStringValue(const std::string& stringValue); 02567 02570 virtual std::string getStringValue() const; 02571 02574 virtual void setDataType(MLDataType dataType); 02575 02577 virtual MLDataType getDataType() const; 02578 02580 virtual void setUniversalTypeValue(const MLTypeData* dataType); 02581 02587 virtual MLTypeData* getUniversalTypeValue() const; 02588 02592 virtual const MLTypeData* getShortLivedUniversalTypeValue() const; 02593 02595 virtual MLldouble getValueCastToLDouble() const; 02596 02597 02598 protected: 02601 virtual void _updateIsValidAndTypeDataFromOrigString(); 02602 02605 virtual void _updateIsValidAndStrValueFromTypeData(); 02606 02607 02608 private: 02612 std::string _origString; 02613 02616 std::string _strValue; 02617 02619 MLDataType _dataType; 02620 02622 MLint _isValid; 02623 02627 MLTypeData* _typeData; 02628 }; 02629 02630 //---------------------------------------------------------------------------------- 02634 //---------------------------------------------------------------------------------- 02635 class MLEXPORT RotationField : public Vector4Field { 02636 02638 ML_CLASS_HEADER(RotationField); 02639 02640 public: 02643 RotationField(const std::string &name=""): Vector4Field(name) {} 02644 02646 void setRotationValue(const Vector3& vec, double angle); 02647 02649 void setRotationValue(const Rotation& rot); 02650 02652 void getRotationValue(Vector3& vec, double& angle) const; 02653 02655 Rotation getRotationValue() const; 02656 }; 02657 02658 02659 //---------------------------------------------------------------------------------- 02663 //---------------------------------------------------------------------------------- 02664 class MLEXPORT PlaneField : public Vector4Field { 02665 02667 ML_CLASS_HEADER(PlaneField); 02668 02669 public: 02672 PlaneField(const std::string &name=""): Vector4Field(name) {} 02673 02675 void setPlaneValue(double f0, double f1, double f2, double f3); 02676 02678 void setPlaneValue(const Plane& p); 02679 02681 void getPlaneValue(double &f0, double &f1, double &f2, double &f3) const; 02682 02684 void getPlaneValue(Plane &plane) const; 02685 02687 Plane getPlaneValue() const; 02688 }; 02689 02690 02691 ML_END_NAMESPACE 02692 02693 02694 #endif //of __mlFields_H 02695 02696 02697