opensurgsim
MovingSquareGlutWindow.h
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 
21 #include "SurgSim/Input/InputConsumerInterface.h"
22 #include "SurgSim/Input/OutputProducerInterface.h"
23 #include "SurgSim/DataStructures/DataGroup.h"
24 
25 #include "SurgSim/Testing/VisualTestCommon/GlutRenderer.h"
26 
31 {
32 public:
34  MovingSquareGlutWindow(const std::string& toolDeviceName, const std::string& squareDeviceName);
37 
38  void initializeInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
39 
40  void handleInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
41 
42 protected:
43 
44 private:
46  boost::thread m_renderThread;
47 
49  const std::string m_toolDeviceName;
51  const std::string m_squareDeviceName;
52 
54  std::shared_ptr<GlutCamera> m_camera;
55 
57  std::shared_ptr<GlutGroup> m_tool;
60  std::shared_ptr<GlutSphere> m_toolSphere;
61 
63  std::shared_ptr<GlutSquare> m_square;
64 
67  void updateTool(const SurgSim::DataStructures::DataGroup& inputData);
70  void updateSquare(const SurgSim::DataStructures::DataGroup& inputData);
71 
72 };
73 
74 #endif // SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREGLUTWINDOW_H
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:68
MovingSquareGlutWindow(const std::string &toolDeviceName, const std::string &squareDeviceName)
Constructor.
Definition: MovingSquareGlutWindow.cpp:23
A simple listener to display the simple scene composed of a square and tool for the example applicati...
Definition: MovingSquareGlutWindow.h:30
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