TranslatePlaneDragger 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_TRANSLATEPLANEDRAGGER
  15. #define OSGMANIPULATOR_TRANSLATEPLANEDRAGGER 1
  16. #include <osgManipulator/Translate2DDragger>
  17. #include <osgManipulator/Translate1DDragger>
  18. namespace osgManipulator {
  19. /**
  20. * Translate plane dragger consists of a wireframe box representing a plane that can be dragged to translate along the plane.
  21. */
  22. class OSGMANIPULATOR_EXPORT TranslatePlaneDragger : public CompositeDragger
  23. {
  24. public:
  25. TranslatePlaneDragger();
  26. META_OSGMANIPULATOR_Object(osgManipulator,TranslatePlaneDragger)
  27. virtual bool handle(const PointerInfo& pi, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
  28. /** Setup default geometry for dragger. */
  29. void setupDefaultGeometry();
  30. inline void setColor(const osg::Vec4& color) { if (_translate2DDragger.valid()) _translate2DDragger->setColor(color); }
  31. Translate1DDragger* getTranslate1DDragger() { return _translate1DDragger.get(); }
  32. Translate2DDragger* getTranslate2DDragger() { return _translate2DDragger.get(); }
  33. protected:
  34. virtual ~TranslatePlaneDragger();
  35. osg::ref_ptr< Translate2DDragger > _translate2DDragger;
  36. osg::ref_ptr< Translate1DDragger > _translate1DDragger;
  37. bool _usingTranslate1DDragger;
  38. };
  39. }
  40. #endif