vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Brush.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ColorGenAdapter.h"
4 #include "DiameterGenAdapter.h"
5 #include "SplineAdapter.h"
7 
8 #include <osg\Referenced>
9 
10 XERCES_CPP_NAMESPACE_USE
11 
12 using namespace vrecko;
13 
14 namespace APDYNAMICART
15 {
16 
17 
19 
23 class Brush : public osg::Referenced
24 {
25 public:
26 
27  Brush( string colorAdapterName, string diameterAdapterName, string crossSectionAdapterName, string rotationFrameAdapterName );
28 
29  //copy constructor - deep copy of Brush have to be done
30  Brush( const Brush& orig);
31 
32  ~Brush() { };
33 
34  osg::ref_ptr<ColorGenAdapter> getColorGenAdapter() { return _colorGenFactory.getAdapter(_colorGenAdapterName); }
35  osg::ref_ptr<DiameterGenAdapter> getDiameterGenAdapter() { return _diamGenFactory.getAdapter(_diamGenAdapterName); }
36  osg::ref_ptr<SplineAdapter> getCrossSectionAdapter() { return _crossSectionFactory.getAdapter(_crossSectionAdapterName); }
37  osg::ref_ptr<RotationFrameAdapter> getRotationFrameAdapter() { return _rotationFrameFactory.getAdapter(_rotationFrameAdapterName); }
38 
39  inline string getCrossSectionAdapterName() const { return _crossSectionAdapterName; }
40  inline string getRotationFrameAdapterName() const { return _rotationFrameAdapterName; }
41 
42  inline double getSmoothness() const { return _smoothness; }
43 
44  ColorGenFactory* getColorGenFactory() { return &_colorGenFactory; }
45 
46  inline int getCrossSectionInterpolationSteps() const { return _crossSectionInterpolationSteps; }
47  inline int getInterpolationSteps() const { return _interpolationSteps; }
48 
49  double getDiameter();
50  bool sliderChanged( const char* sliderID, float sliderPos );
51  bool guiItemClicked( const char* itemID );
52  bool setDiameterAdapter( string name );
53  bool setColorAdapter( string name );
54  bool setCrossSectionAdapter( string name );
55  bool setRotationFrameAdapter( string name );
56 
57  void save( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* Document, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * ParametersNode );
58  void createMenu( MenuPtr menu, bool colorMenu = true );
59  void load( DOMNode* ParametersNode );
60  void setDiameter( float sliderPos );
61 
62  inline void setInterpolationSteps( int steps ) { _interpolationSteps = steps; }
63  void setCrossSectionInterpolationSteps( int steps );
64  inline void setSmoothness(double val) { _smoothness = val; }
65 
66 
67 
68 protected:
69 
70  // interpolation of leading spline
72 
73  // interpolation of cross-section curve
75 
76  //smoothing of leading spline
77  double _smoothness;
78 
81 
84 
87 
90 
91 
92 
98 
99 };
100 
101 typedef osg::ref_ptr<Brush> BrushPtr;
102 
103 }
104 
105