TranslateAxisDragger 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_TRANSLATEAXISDRAGGER
  15. #define OSGMANIPULATOR_TRANSLATEAXISDRAGGER 1
  16. #include <osgManipulator/Translate1DDragger>
  17. #include <osg/ShapeDrawable>
  18. #include <osg/Geometry>
  19. #include <osg/LineWidth>
  20. namespace osgManipulator {
  21. /**
  22. * Dragger for performing translation in all three axes.
  23. */
  24. class OSGMANIPULATOR_EXPORT TranslateAxisDragger : public CompositeDragger
  25. {
  26. public:
  27. TranslateAxisDragger();
  28. META_OSGMANIPULATOR_Object(osgManipulator,TranslateAxisDragger)
  29. /** Setup default geometry for dragger. */
  30. void setupDefaultGeometry();
  31. /** Sets the width of the axis lines in pixels. */
  32. void setAxisLineWidth(float linePixelWidth);
  33. /** Retrieves the width of the axis lines in pixels. */
  34. float getAxisLineWidth() const { return _axisLineWidth; }
  35. /** Sets the radius of the cylinders representing the axis lines for picking. */
  36. void setPickCylinderRadius(float pickCylinderRadius);
  37. /** Retrieves the radius of the cylinders representing the axis lines for picking. */
  38. float getPickCylinderRadius() const { return _pickCylinderRadius; }
  39. /** Sets the height of the cones. */
  40. void setConeHeight(float radius);
  41. /** Retrieves the height of the cones. */
  42. float getConeHeight() const { return _coneHeight; }
  43. protected:
  44. virtual ~TranslateAxisDragger();
  45. osg::ref_ptr< Translate1DDragger > _xDragger;
  46. osg::ref_ptr< Translate1DDragger > _yDragger;
  47. osg::ref_ptr< Translate1DDragger > _zDragger;
  48. float _coneHeight;
  49. float _axisLineWidth;
  50. float _pickCylinderRadius;
  51. osg::ref_ptr<osg::Geode> _lineGeode;
  52. osg::ref_ptr<osg::Cylinder> _cylinder;
  53. osg::ref_ptr<osg::LineWidth> _lineWidth;
  54. osg::ref_ptr<osg::Cone> _cone;
  55. };
  56. }
  57. #endif