TrackballDragger 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. //osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
  14. #ifndef OSGMANIPULATOR_TRACKBALLDRAGGER
  15. #define OSGMANIPULATOR_TRACKBALLDRAGGER 1
  16. #include <osgManipulator/RotateCylinderDragger>
  17. #include <osgManipulator/RotateSphereDragger>
  18. #include <osg/ShapeDrawable>
  19. #include <osg/Geometry>
  20. #include <osg/Geode>
  21. #include <osg/LineWidth>
  22. namespace osgManipulator {
  23. /**
  24. * Dragger for performing rotation in all axes.
  25. */
  26. class OSGMANIPULATOR_EXPORT TrackballDragger : public CompositeDragger
  27. {
  28. public:
  29. TrackballDragger(bool useAutoTransform=false);
  30. META_OSGMANIPULATOR_Object(osgManipulator,TrackballDragger)
  31. /** Setup default geometry for dragger. */
  32. void setupDefaultGeometry();
  33. /** Sets the width of the axis lines in pixels. */
  34. void setAxisLineWidth(float linePixelWidth);
  35. /** Retrieves the width of the axis lines in pixels. */
  36. float getAxisLineWidth() const { return _axisLineWidth; }
  37. /** Sets the height of the cylinders representing the axis lines for picking. */
  38. void setPickCylinderHeight(float pickCylinderHeight);
  39. /** Retrieves the height of the cylinders representing the axis lines for picking. */
  40. float getPickCylinderHeight() const { return _pickCylinderHeight; }
  41. protected:
  42. virtual ~TrackballDragger();
  43. osg::ref_ptr<RotateCylinderDragger> _xDragger;
  44. osg::ref_ptr<RotateCylinderDragger> _yDragger;
  45. osg::ref_ptr<RotateCylinderDragger> _zDragger;
  46. osg::ref_ptr<RotateSphereDragger> _xyzDragger;
  47. float _axisLineWidth;
  48. float _pickCylinderHeight;
  49. osg::ref_ptr<osg::Geode> _geode;
  50. osg::ref_ptr<osg::Cylinder> _cylinder;
  51. osg::ref_ptr<osg::LineWidth> _lineWidth;
  52. };
  53. }
  54. #endif