From 9e430b3fc21bb9eceb92b04dda65e5786d4cd273 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Mon, 2 Aug 2021 23:36:04 +0100 Subject: [PATCH] CameraGroup: Add removeCamera() Add removeCamera() method to CameraGroup to find and remove a single CameraInfo. This will allow cameras created for VR to be dynamically reconfigured. --- src/Viewer/CameraGroup.cxx | 10 ++++++++++ src/Viewer/CameraGroup.hxx | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/Viewer/CameraGroup.cxx b/src/Viewer/CameraGroup.cxx index 15b6f0029..a32ad3f15 100644 --- a/src/Viewer/CameraGroup.cxx +++ b/src/Viewer/CameraGroup.cxx @@ -721,6 +721,16 @@ CameraInfo* CameraGroup::buildCamera(SGPropertyNode* cameraNode) return info; } +void CameraGroup::removeCamera(CameraInfo *info) +{ + for (auto it = _cameras.begin(); it != _cameras.end(); ++it) { + if (*it == info) { + _cameras.erase(it); + return; + } + } +} + void CameraGroup::buildGUICamera(SGPropertyNode* cameraNode, GraphicsWindow* window) { diff --git a/src/Viewer/CameraGroup.hxx b/src/Viewer/CameraGroup.hxx index 0f24adf65..9ebcc570e 100644 --- a/src/Viewer/CameraGroup.hxx +++ b/src/Viewer/CameraGroup.hxx @@ -151,6 +151,10 @@ public: * @return a CameraInfo object for the camera. */ CameraInfo* buildCamera(SGPropertyNode* cameraNode); + /** Remove a camera from the camera group. + * @param info the camera info to remove. + */ + void removeCamera(CameraInfo *info); /** Create a camera from properties that will draw the GUI and add * it to the camera group. * @param cameraNode the property node. This can be 0, in which