MovingSquareGlutWindow.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREGLUTWINDOW_H
#define SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREGLUTWINDOW_H
#include <boost/thread.hpp>
#include "SurgSim/Input/InputConsumerInterface.h"
#include "SurgSim/Input/OutputProducerInterface.h"
#include "SurgSim/DataStructures/DataGroup.h"
#include "SurgSim/Testing/VisualTestCommon/GlutRenderer.h"
class MovingSquareGlutWindow : public SurgSim::Input::InputConsumerInterface
{
public:
MovingSquareGlutWindow(const std::string& toolDeviceName, const std::string& squareDeviceName);
~MovingSquareGlutWindow();
void initializeInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
void handleInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
protected:
private:
boost::thread m_renderThread;
const std::string m_toolDeviceName;
const std::string m_squareDeviceName;
std::shared_ptr<GlutCamera> m_camera;
std::shared_ptr<GlutGroup> m_tool;
std::shared_ptr<GlutSphere> m_toolSphere;
std::shared_ptr<GlutSquare> m_square;
void updateTool(const SurgSim::DataStructures::DataGroup& inputData);
void updateSquare(const SurgSim::DataStructures::DataGroup& inputData);
};
#endif // SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREGLUTWINDOW_H
MovingSquareGlutWindow::m_square
std::shared_ptr< GlutSquare > m_square
Square that is moved with device input.
Definition: MovingSquareGlutWindow.h:63
DataGroup.h
GlutRenderer.h
MovingSquareGlutWindow::m_toolDeviceName
const std::string m_toolDeviceName
Name of the tool device.
Definition: MovingSquareGlutWindow.h:49
MovingSquareGlutWindow::m_toolSphere
std::shared_ptr< GlutSphere > m_toolSphere
Sphere of the tool.
Definition: MovingSquareGlutWindow.h:60
MovingSquareGlutWindow::updateTool
void updateTool(const SurgSim::DataStructures::DataGroup &inputData)
Updates the tool based on the device input.
Definition: MovingSquareGlutWindow.cpp:74
MovingSquareGlutWindow::m_squareDeviceName
const std::string m_squareDeviceName
Name of the square device.
Definition: MovingSquareGlutWindow.h:51
MovingSquareGlutWindow::handleInput
void handleInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
Notifies the consumer that the application input coming from the device has been updated.
Definition: MovingSquareGlutWindow.cpp:58
SurgSim::Input::InputConsumerInterface
Interface for a consumer that monitors device and signal state updates (pose, buttons, etc).
Definition: InputConsumerInterface.h:33
InputConsumerInterface.h
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
OutputProducerInterface.h
MovingSquareGlutWindow::m_renderThread
boost::thread m_renderThread
Render thread which runs the Glut main loop.
Definition: MovingSquareGlutWindow.h:46
MovingSquareGlutWindow::m_camera
std::shared_ptr< GlutCamera > m_camera
Camera which controls the view of the scene.
Definition: MovingSquareGlutWindow.h:54
MovingSquareGlutWindow::MovingSquareGlutWindow
MovingSquareGlutWindow(const std::string &toolDeviceName, const std::string &squareDeviceName)
Constructor.
Definition: MovingSquareGlutWindow.cpp:23
MovingSquareGlutWindow::updateSquare
void updateSquare(const SurgSim::DataStructures::DataGroup &inputData)
Updates the square based on the device input.
Definition: MovingSquareGlutWindow.cpp:136
MovingSquareGlutWindow
A simple listener to display the simple scene composed of a square and tool for the example applicati...
Definition: MovingSquareGlutWindow.h:30
MovingSquareGlutWindow::m_tool
std::shared_ptr< GlutGroup > m_tool
Tool composed of a sphere and axes that are moved with device input.
Definition: MovingSquareGlutWindow.h:57
MovingSquareGlutWindow::initializeInput
void initializeInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
Set the initial input data group.
Definition: MovingSquareGlutWindow.cpp:54
MovingSquareGlutWindow::~MovingSquareGlutWindow
~MovingSquareGlutWindow()
Destructor.
Definition: MovingSquareGlutWindow.cpp:46