MovingSquareGlutWindow.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREGLUTWINDOW_H
17 #define SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREGLUTWINDOW_H
18 
19 #include <boost/thread.hpp>
20 
24 
26 
31 {
32 public:
34  MovingSquareGlutWindow(const std::string& toolDeviceName, const std::string& squareDeviceName);
37 
38  virtual void initializeInput(const std::string& device,
39  const SurgSim::DataStructures::DataGroup& inputData) override;
40 
41  virtual void handleInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
42 
43 protected:
44 
45 private:
47  boost::thread m_renderThread;
48 
50  const std::string m_toolDeviceName;
52  const std::string m_squareDeviceName;
53 
55  std::shared_ptr<GlutCamera> m_camera;
56 
58  std::shared_ptr<GlutGroup> m_tool;
61  std::shared_ptr<GlutSphere> m_toolSphere;
62 
64  std::shared_ptr<GlutSquare> m_square;
65 
68  void updateTool(const SurgSim::DataStructures::DataGroup& inputData);
71  void updateSquare(const SurgSim::DataStructures::DataGroup& inputData);
72 
73 };
74 
75 #endif // SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREGLUTWINDOW_H
std::shared_ptr< GlutSquare > m_square
Square that is moved with device input.
Definition: MovingSquareGlutWindow.h:64
const std::string m_toolDeviceName
Name of the tool device.
Definition: MovingSquareGlutWindow.h:50
std::shared_ptr< GlutSphere > m_toolSphere
Sphere of the tool.
Definition: MovingSquareGlutWindow.h:61
void updateTool(const SurgSim::DataStructures::DataGroup &inputData)
Updates the tool based on the device input.
Definition: MovingSquareGlutWindow.cpp:74
const std::string m_squareDeviceName
Name of the square device.
Definition: MovingSquareGlutWindow.h:52
virtual 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
Interface for a consumer that monitors device and signal state updates (pose, buttons, etc).
Definition: InputConsumerInterface.h:33
A collection of NamedData objects.
Definition: DataGroup.h:66
boost::thread m_renderThread
Render thread which runs the Glut main loop.
Definition: MovingSquareGlutWindow.h:47
std::shared_ptr< GlutCamera > m_camera
Camera which controls the view of the scene.
Definition: MovingSquareGlutWindow.h:55
MovingSquareGlutWindow(const std::string &toolDeviceName, const std::string &squareDeviceName)
Constructor.
Definition: MovingSquareGlutWindow.cpp:23
void updateSquare(const SurgSim::DataStructures::DataGroup &inputData)
Updates the square based on the device input.
Definition: MovingSquareGlutWindow.cpp:136
A simple listener to display the simple scene composed of a square and tool for the example applicati...
Definition: MovingSquareGlutWindow.h:30
std::shared_ptr< GlutGroup > m_tool
Tool composed of a sphere and axes that are moved with device input.
Definition: MovingSquareGlutWindow.h:58
virtual void initializeInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
Set the initial input data group.
Definition: MovingSquareGlutWindow.cpp:54
~MovingSquareGlutWindow()
Destructor.
Definition: MovingSquareGlutWindow.cpp:46