![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2011 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00007 #pragma once 00008 00009 #include <vrvCore/vrvCore.h> 00010 #include <vrvUtil/DtUnicode.h> 00011 00012 #include <boost/tuple/tuple.hpp> 00013 00014 #include <matrix/vlVector.h> 00015 00016 #include <string> 00017 #include <map> 00018 #include <vector> 00019 00020 namespace makVrv 00021 { 00024 class DT_DLL_VRVCORE DtVisualizerAttribute 00025 { 00026 public: 00027 00029 virtual ~DtVisualizerAttribute(); 00030 00031 //Type info struct. 00032 struct TypeInfo 00033 { 00034 TypeInfo(const std::string& name) 00035 : className(name) 00036 { 00037 } 00038 00039 std::string className; 00040 }; 00041 00043 virtual DtVisualizerAttribute* clone() const = 0; 00044 00046 virtual const TypeInfo& typeInfo() const = 0; 00047 00049 virtual DtUnicode getString() const = 0; 00050 00052 virtual void setString(const DtUnicode& value) = 0; 00053 }; 00054 00057 class DT_DLL_VRVCORE DtVisualizerAttributeBool : public DtVisualizerAttribute 00058 { 00059 public: 00061 DtVisualizerAttributeBool(bool value = false); 00062 00064 DtVisualizerAttributeBool(const DtUnicode& value); 00065 00067 virtual const TypeInfo& typeInfo() const; 00068 00070 static const TypeInfo& theTypeInfo(); 00071 00074 virtual DtUnicode getString() const; 00075 00079 virtual void setString(const DtUnicode& value); 00080 00082 virtual bool value() const; 00083 00085 virtual void setValue(bool value); 00086 00090 virtual DtVisualizerAttribute* clone() const; 00091 00092 protected: 00093 bool myValue; 00094 }; 00095 00098 class DT_DLL_VRVCORE DtVisualizerAttributeStringVector : 00099 public DtVisualizerAttribute 00100 { 00101 public: 00102 typedef std::vector<DtUnicode> StringVector; 00103 00105 DtVisualizerAttributeStringVector(const StringVector& value = StringVector()); 00106 00108 DtVisualizerAttributeStringVector(const DtUnicode& value); 00109 00111 virtual const TypeInfo& typeInfo() const; 00112 00114 static const TypeInfo& theTypeInfo(); 00115 00118 virtual DtUnicode getString() const; 00119 00123 virtual void setString(const DtUnicode& value); 00124 00126 virtual const StringVector& value() const 00127 { 00128 return myValue; 00129 } 00130 00131 inline bool findAndReplace(const DtUnicode& orig, const DtUnicode newValue) 00132 { 00133 bool found = false; 00134 StringVector::iterator i = myValue.begin(); 00135 StringVector::iterator e = myValue.end(); 00136 for(; i != e; ++i) 00137 { 00138 if(*i == orig) 00139 { 00140 *i = newValue; 00141 found = true; 00142 } 00143 } 00144 return found; 00145 } 00146 00148 virtual void setValue(const StringVector& value); 00149 00153 virtual DtVisualizerAttribute* clone() const; 00154 00155 protected: 00156 StringVector myValue; 00157 }; 00158 00159 00162 class DT_DLL_VRVCORE DtVisualizerAttributeString : 00163 public DtVisualizerAttribute 00164 { 00165 public: 00167 DtVisualizerAttributeString(const DtUnicode& value = DtUnicode()); 00168 00170 virtual const TypeInfo& typeInfo() const; 00171 00173 static const TypeInfo& theTypeInfo(); 00174 00177 virtual DtUnicode getString() const; 00178 00182 virtual void setString(const DtUnicode& value); 00183 00185 virtual DtUnicode value() const; 00186 00188 virtual void setValue(const DtUnicode& value); 00189 00193 virtual DtVisualizerAttribute* clone() const; 00194 00195 protected: 00196 DtUnicode myValue; 00197 }; 00198 00199 00202 class DT_DLL_VRVCORE DtVisualizerAttributeModelDefinition : 00203 public DtVisualizerAttributeString 00204 { 00205 public: 00207 DtVisualizerAttributeModelDefinition(const DtUnicode& value = DtUnicode()); 00208 00210 virtual const TypeInfo& typeInfo() const; 00211 00213 static const TypeInfo& theTypeInfo(); 00214 }; 00215 00216 00220 class DT_DLL_VRVCORE DtVisualizerAttributeEnumeration : 00221 public DtVisualizerAttribute 00222 { 00223 public: 00225 DtVisualizerAttributeEnumeration(const DtUnicode& value = DtUnicode()); 00226 00228 virtual const TypeInfo& typeInfo() const; 00229 00231 static const TypeInfo& theTypeInfo(); 00232 00235 virtual DtUnicode getString() const; 00236 00240 virtual void setString(const DtUnicode& value); 00241 00243 virtual DtUnicode value() const; 00244 00246 virtual void setValue(const DtUnicode& value); 00247 00251 virtual DtVisualizerAttribute* clone() const; 00252 00253 protected: 00254 DtUnicode myValue; 00255 }; 00256 00257 00260 class DT_DLL_VRVCORE DtVisualizerAttributeInteger : 00261 public DtVisualizerAttribute 00262 { 00263 public: 00265 DtVisualizerAttributeInteger(int value = 0); 00266 00268 DtVisualizerAttributeInteger(const DtUnicode& value); 00269 00271 virtual const TypeInfo& typeInfo() const; 00272 00274 static const TypeInfo& theTypeInfo(); 00275 00278 virtual DtUnicode getString() const; 00279 00283 virtual void setString(const DtUnicode& value); 00284 00286 virtual int value() const; 00287 00289 virtual void setValue(int value); 00290 00294 virtual DtVisualizerAttribute* clone() const; 00295 00296 protected: 00297 int myValue; 00298 }; 00299 00302 class DT_DLL_VRVCORE DtVisualizerAttributeFontGlyph : 00303 public DtVisualizerAttribute 00304 { 00305 public: 00306 // FontGlyphs are represented as unsigned ints: 00307 typedef unsigned int FontGlyph; 00308 00310 DtVisualizerAttributeFontGlyph(FontGlyph value = 0); 00311 00313 DtVisualizerAttributeFontGlyph(const DtUnicode& value); 00314 00316 virtual const TypeInfo& typeInfo() const; 00317 00319 static const TypeInfo& theTypeInfo(); 00320 00323 virtual DtUnicode getString() const; 00324 00328 virtual void setString(const DtUnicode& value); 00329 00331 virtual FontGlyph value() const; 00332 00334 virtual void setValue(FontGlyph value); 00335 00339 virtual DtVisualizerAttribute* clone() const; 00340 00341 protected: 00342 FontGlyph myValue; 00343 }; 00344 00347 class DT_DLL_VRVCORE DtVisualAttributeSymbolSelector : 00348 public DtVisualizerAttribute 00349 { 00350 public: 00351 // Selected symbols are represented as a map between integer and string: 00352 typedef std::map<int, DtUnicode> ImageSymbolMap; 00353 00355 DtVisualAttributeSymbolSelector(ImageSymbolMap value = ImageSymbolMap()); 00356 00358 virtual const TypeInfo& typeInfo() const; 00359 00361 static const TypeInfo& theTypeInfo(); 00362 00365 virtual DtUnicode getString() const; 00366 00370 virtual void setString(const DtUnicode& value); 00371 00373 virtual const ImageSymbolMap& value() const; 00374 00376 virtual void setValue(ImageSymbolMap value); 00377 00381 virtual DtVisualizerAttribute* clone() const; 00382 00383 protected: 00384 ImageSymbolMap myValue; 00385 }; 00386 00389 class DT_DLL_VRVCORE DtVisualizerAttributeFloat : 00390 public DtVisualizerAttribute 00391 { 00392 public: 00394 DtVisualizerAttributeFloat(float value = 0.0f); 00395 00397 DtVisualizerAttributeFloat(const DtUnicode& value); 00398 00400 virtual const TypeInfo& typeInfo() const; 00401 00403 static const TypeInfo& theTypeInfo(); 00404 00407 virtual DtUnicode getString() const; 00408 00412 virtual void setString(const DtUnicode& value); 00413 00415 virtual float value() const; 00416 00418 virtual void setValue(float value); 00419 00423 virtual DtVisualizerAttribute* clone() const; 00424 00425 protected: 00426 float myValue; 00427 }; 00428 00430 class DT_DLL_VRVCORE DtVisualizerAttributeFilename : public DtVisualizerAttribute 00431 { 00432 public: 00434 DtVisualizerAttributeFilename(const DtUnicode& value = DtUnicode()); 00435 00437 virtual const TypeInfo& typeInfo() const; 00438 00440 static const TypeInfo& theTypeInfo(); 00441 00444 virtual DtUnicode getString() const; 00445 00449 virtual void setString(const DtUnicode& value); 00450 00452 virtual DtUnicode value() const; 00453 00455 virtual void setValue(const DtUnicode& value); 00456 00460 virtual DtVisualizerAttribute* clone() const; 00461 00462 protected: 00463 DtVisualizerAttributeString myStringAttr; 00464 }; 00465 00468 class DT_DLL_VRVCORE DtVisualizerAttributeColor: public DtVisualizerAttribute 00469 { 00470 public: 00471 // Colors are represented as boost 4-tuples of RGBA values (in that order) 00472 typedef boost::tuple<unsigned int, unsigned int, unsigned int, 00473 unsigned int> RGBAColor; 00474 00476 DtVisualizerAttributeColor(RGBAColor value = RGBAColor(0,0,0,0)); 00477 00479 DtVisualizerAttributeColor(const DtUnicode& value); 00480 00482 virtual const TypeInfo& typeInfo() const; 00483 00485 static const TypeInfo& theTypeInfo(); 00486 00489 virtual DtUnicode getString() const; 00490 00494 virtual void setString(const DtUnicode& value); 00495 00497 virtual RGBAColor value() const; 00498 00500 virtual void setValue(RGBAColor value); 00501 00505 virtual DtVisualizerAttribute* clone() const; 00506 00507 protected: 00508 RGBAColor myValue; 00509 }; 00510 00513 class DT_DLL_VRVCORE DtVisualizerAttributePoint3D : 00514 public DtVisualizerAttribute 00515 { 00516 public: 00518 DtVisualizerAttributePoint3D(const DtVector& value = DtVector()); 00519 00521 DtVisualizerAttributePoint3D(const DtUnicode& value); 00522 00524 virtual const TypeInfo& typeInfo() const; 00525 00527 static const TypeInfo& theTypeInfo(); 00528 00531 virtual DtUnicode getString() const; 00532 00536 virtual void setString(const DtUnicode& value); 00537 00539 virtual const DtVector& value() const; 00540 00542 virtual void setValue(const DtVector& value); 00543 00547 virtual DtVisualizerAttribute* clone() const; 00548 00549 protected: 00550 DtVector myValue; 00551 }; 00552 }