From c9307ef851ddb7aaa37c9fb31607dfe2ba71ea6d Mon Sep 17 00:00:00 2001
From: sebastianfreitag <freitag@vr.rwth-aachen.de>
Date: Wed, 21 Dec 2016 14:04:55 +0100
Subject: [PATCH] added VistaSimpleOpenGLDraw, an IVistaOpenGLDraw which can
 take a draw routine as constructor parameter (e.g., as a lambda function)

---
 .../GraphicsManager/VistaSimpleOpenGLDraw.cpp | 70 +++++++++++++++++
 .../GraphicsManager/VistaSimpleOpenGLDraw.h   | 77 +++++++++++++++++++
 .../GraphicsManager/_SourceFiles.cmake        |  2 +
 3 files changed, 149 insertions(+)
 create mode 100644 VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.cpp
 create mode 100644 VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.h

diff --git a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.cpp b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.cpp
new file mode 100644
index 000000000..0ad4d5b00
--- /dev/null
+++ b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.cpp
@@ -0,0 +1,70 @@
+/*============================================================================*/
+/*                              ViSTA VR toolkit                              */
+/*               Copyright (c) 1997-2016 RWTH Aachen University               */
+/*============================================================================*/
+/*                                  License                                   */
+/*                                                                            */
+/*  This program is free software: you can redistribute it and/or modify      */
+/*  it under the terms of the GNU Lesser General Public License as published  */
+/*  by the Free Software Foundation, either version 3 of the License, or      */
+/*  (at your option) any later version.                                       */
+/*                                                                            */
+/*  This program is distributed in the hope that it will be useful,           */
+/*  but WITHOUT ANY WARRANTY; without even the implied warranty of            */
+/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
+/*  GNU Lesser General Public License for more details.                       */
+/*                                                                            */
+/*  You should have received a copy of the GNU Lesser General Public License  */
+/*  along with this program.  If not, see <http://www.gnu.org/licenses/>.     */
+/*============================================================================*/
+/*                                Contributors                                */
+/*                                                                            */
+/*============================================================================*/
+
+/*============================================================================*/
+/* INCLUDES                                                                   */
+/*============================================================================*/
+#include "VistaSimpleOpenGLDraw.h"
+
+
+/*============================================================================*/
+/* CONSTRUCTORS / DESTRUCTOR                                                  */
+/*============================================================================*/
+
+VistaSimpleOpenGLDraw::VistaSimpleOpenGLDraw(
+	std::function<void()> funcDraw, 
+	const VistaBoundingBox& oBoundingBox)
+	: IVistaOpenGLDraw()
+	, m_funcDraw(funcDraw)
+	, m_oBB(oBoundingBox)
+{
+
+}
+
+VistaSimpleOpenGLDraw::~VistaSimpleOpenGLDraw()
+{
+
+}
+
+
+
+/*============================================================================*/
+/* IMPLEMENTATION                                                             */
+/*============================================================================*/
+
+bool VistaSimpleOpenGLDraw::Do()
+{
+	m_funcDraw();
+	return true;
+}
+
+bool VistaSimpleOpenGLDraw::GetBoundingBox(VistaBoundingBox &bb)
+{
+	bb = m_oBB;
+	return true;
+}
+
+/*============================================================================*/
+/* END OF FILE		                                                          */
+/*============================================================================*/
+
diff --git a/VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.h b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.h
new file mode 100644
index 000000000..c5f57ee59
--- /dev/null
+++ b/VistaCoreLibs/VistaKernel/GraphicsManager/VistaSimpleOpenGLDraw.h
@@ -0,0 +1,77 @@
+/*============================================================================*/
+/*                              ViSTA VR toolkit                              */
+/*               Copyright (c) 1997-2016 RWTH Aachen University               */
+/*============================================================================*/
+/*                                  License                                   */
+/*                                                                            */
+/*  This program is free software: you can redistribute it and/or modify      */
+/*  it under the terms of the GNU Lesser General Public License as published  */
+/*  by the Free Software Foundation, either version 3 of the License, or      */
+/*  (at your option) any later version.                                       */
+/*                                                                            */
+/*  This program is distributed in the hope that it will be useful,           */
+/*  but WITHOUT ANY WARRANTY; without even the implied warranty of            */
+/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
+/*  GNU Lesser General Public License for more details.                       */
+/*                                                                            */
+/*  You should have received a copy of the GNU Lesser General Public License  */
+/*  along with this program.  If not, see <http://www.gnu.org/licenses/>.     */
+/*============================================================================*/
+/*                                Contributors                                */
+/*                                                                            */
+/*============================================================================*/
+
+
+#ifndef _VISTASIMPLEOPENGLDRAW_H
+#define _VISTASIMPLEOPENGLDRAW_H
+
+
+/*============================================================================*/
+/* INCLUDES                                                                   */
+/*============================================================================*/
+
+#include "../VistaKernelConfig.h"
+#include "VistaOpenGLDraw.h"
+#include <functional>
+
+#include "VistaMath/VistaBoundingBox.h"
+
+/*============================================================================*/
+/* FORWARD DECLARATIONS                                                       */
+/*============================================================================*/
+
+
+/*============================================================================*/
+/* CLASS DEFINITIONS                                                          */
+/*============================================================================*/
+
+class VISTAKERNELAPI VistaSimpleOpenGLDraw : public IVistaOpenGLDraw
+{
+public:
+	
+	VistaSimpleOpenGLDraw(std::function<void()> funcDraw, const VistaBoundingBox& oBoundingBox);
+	virtual ~VistaSimpleOpenGLDraw();
+
+	virtual bool Do();
+
+	virtual bool GetBoundingBox(VistaBoundingBox &bb);
+
+	
+
+protected:
+
+	VistaBoundingBox m_oBB;
+	std::function<void()> m_funcDraw;
+
+private:	
+
+
+
+};
+
+#endif // _VISTASIMPLEOPENGLDRAW_H
+
+
+/*============================================================================*/
+/* END OF FILE		                                                          */
+/*============================================================================*/
diff --git a/VistaCoreLibs/VistaKernel/GraphicsManager/_SourceFiles.cmake b/VistaCoreLibs/VistaKernel/GraphicsManager/_SourceFiles.cmake
index a35ef835b..f81fdfd89 100644
--- a/VistaCoreLibs/VistaKernel/GraphicsManager/_SourceFiles.cmake
+++ b/VistaCoreLibs/VistaKernel/GraphicsManager/_SourceFiles.cmake
@@ -37,6 +37,8 @@ set( DirFiles
 	VistaOpenGLDebug.h
 	VistaOpenGLDraw.cpp
 	VistaOpenGLDraw.h
+	VistaSimpleOpenGLDraw.cpp
+	VistaSimpleOpenGLDraw.h
 	VistaOpenGLNode.cpp
 	VistaOpenGLNode.h
 	VistaOpenGLPolyLine.cpp
-- 
GitLab