From 21a74223e6e687ca8a98814188a8723cb8837a5e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 19 Mar 2003 21:14:50 +0000 Subject: [PATCH] Added getCameraManipulator(unsigned int) method. --- include/osgGA/KeySwitchCameraManipulator | 6 ++++++ src/osgGA/KeySwitchCameraManipulator.cpp | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/osgGA/KeySwitchCameraManipulator b/include/osgGA/KeySwitchCameraManipulator index 804065074..123b22298 100644 --- a/include/osgGA/KeySwitchCameraManipulator +++ b/include/osgGA/KeySwitchCameraManipulator @@ -56,6 +56,12 @@ public: const CameraManipulator* getCurrentCameraManipulator() const { return _current.get(); } + + CameraManipulator* getCameraManipulator(unsigned int num); + + const CameraManipulator* getCameraManipulator(unsigned int num) const; + + // Overrides from CameraManipulator... diff --git a/src/osgGA/KeySwitchCameraManipulator.cpp b/src/osgGA/KeySwitchCameraManipulator.cpp index f890e0b47..69ca9c4c9 100644 --- a/src/osgGA/KeySwitchCameraManipulator.cpp +++ b/src/osgGA/KeySwitchCameraManipulator.cpp @@ -42,6 +42,20 @@ void KeySwitchCameraManipulator::selectCameraManipulator(unsigned int num) } } +CameraManipulator* KeySwitchCameraManipulator::getCameraManipulator(unsigned int num) +{ + KeyManipMap::iterator itr = _manips.find(num); + if (itr!=_manips.end()) return itr->second.second.get(); + else return 0; +} + +const CameraManipulator* KeySwitchCameraManipulator::getCameraManipulator(unsigned int num) const +{ + KeyManipMap::const_iterator itr = _manips.find(num); + if (itr!=_manips.end()) return itr->second.second.get(); + else return 0; +} + bool KeySwitchCameraManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa) { if(ea.getEventType()==GUIEventAdapter::KEYDOWN){