MovingSquareGlutWindow Class Reference

A simple listener to display the simple scene composed of a square and tool for the example application. More...

`#include <SurgSim/Testing/VisualTestCommon/MovingSquareGlutWindow.h>`

Inheritance diagram for MovingSquareGlutWindow:

## Public Member Functions

| MovingSquareGlutWindow (const std::string &toolDeviceName, const std::string &squareDeviceName)
| Constructor. More...
| ~MovingSquareGlutWindow ()
| Destructor. More...
void | initializeInput (const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
| Set the initial input data group. More...
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. More...
Public Member Functions inherited from SurgSim::Input::InputConsumerInterface
virtual | ~InputConsumerInterface ()
| Virtual destructor (empty). More...

## Private Member Functions

void | updateTool (const SurgSim::DataStructures::DataGroup &inputData)
| Updates the tool based on the device input. More...
void | updateSquare (const SurgSim::DataStructures::DataGroup &inputData)
| Updates the square based on the device input. More...

## Private Attributes

boost::thread | m_renderThread
| Render thread which runs the Glut main loop. More...
const std::string | m_toolDeviceName
| Name of the tool device. More...
const std::string | m_squareDeviceName
| Name of the square device. More...
std::shared_ptr< GlutCamera > | m_camera
| Camera which controls the view of the scene. More...
std::shared_ptr< GlutGroup > | m_tool
| Tool composed of a sphere and axes that are moved with device input. More...
std::shared_ptr< GlutSphere > | m_toolSphere
| Sphere of the tool. More...
std::shared_ptr< GlutSquare > | m_square
| Square that is moved with device input. More...

## Detailed Description

A simple listener to display the simple scene composed of a square and tool for the example application.

Includes support for the square being moved by a second tool.

See also
  SurgSim::Input::InputConsumerInterface

## Constructor & Destructor Documentation

## MovingSquareGlutWindow()

MovingSquareGlutWindow::MovingSquareGlutWindow | ( | const std::string & | toolDeviceName,
|  | const std::string & | squareDeviceName
| ) |  |

Constructor.

## ~MovingSquareGlutWindow()

MovingSquareGlutWindow::~MovingSquareGlutWindow | ( |  | ) |

Destructor.

## Member Function Documentation

## handleInput()

void MovingSquareGlutWindow::handleInput | ( | const std::string & | device,
|  | const SurgSim::DataStructures::DataGroup & | inputData
| ) |  |

override virtual

Notifies the consumer that the application input coming from the device has been updated.

Typical input data contents (but note that individual devices may do things differently):

type | name |
--- | --- | ---
pose | "pose" | Device pose (units are meters).
bool | "button1" | State of the first device button.
bool | "button2" | State of the second device button (and so on).

Other possible contents includes:

type | name |
--- | --- | ---
bool | "isHomed" | Device homing status.
bool | "isHomedX" | Individual homing status for the X axis (and so on).
bool | "isHeld" | Safety sensor etc. status.
string | "model" | Device model description.
string | "serial" | Serial number string.
(any) | "debug:*" | Various debugging information

Parameters

  device | The name of the device that is producing the input. This should only be used to identify the device (e.g. if the consumer is listening to several devices at once).
  inputData | The application input state coming from the device.

Implements SurgSim::Input::InputConsumerInterface.

## initializeInput()

void MovingSquareGlutWindow::initializeInput | ( | const std::string & | device,
|  | const SurgSim::DataStructures::DataGroup & | inputData
| ) |  |

override virtual

Set the initial input data group.

Parameters

  device | The name of the device that is producing the input. This should only be used to identify the device (e.g. if the consumer is listening to several devices at once).
  inputData | The application input state coming from the device.

Implements SurgSim::Input::InputConsumerInterface.

## updateSquare()

void MovingSquareGlutWindow::updateSquare | ( | const SurgSim::DataStructures::DataGroup & | inputData | ) |

private

Updates the square based on the device input.

Parameters

  inputData | Input data from the device.

## updateTool()

void MovingSquareGlutWindow::updateTool | ( | const SurgSim::DataStructures::DataGroup & | inputData | ) |

private

Updates the tool based on the device input.

Parameters

  inputData | Input data from the device.

## Member Data Documentation

## m_camera

std::shared_ptr<GlutCamera> MovingSquareGlutWindow::m_camera

private

Camera which controls the view of the scene.

## m_renderThread

boost::thread MovingSquareGlutWindow::m_renderThread

private

Render thread which runs the Glut main loop.

## m_square

std::shared_ptr<GlutSquare> MovingSquareGlutWindow::m_square

private

Square that is moved with device input.

## m_squareDeviceName

const std::string MovingSquareGlutWindow::m_squareDeviceName

private

Name of the square device.

## m_tool

std::shared_ptr<GlutGroup> MovingSquareGlutWindow::m_tool

private

Tool composed of a sphere and axes that are moved with device input.

## m_toolDeviceName

const std::string MovingSquareGlutWindow::m_toolDeviceName

private

Name of the tool device.

## m_toolSphere

std::shared_ptr<GlutSphere> MovingSquareGlutWindow::m_toolSphere

private

Sphere of the tool.

Pointer is kept here so that the color can easily be changed based on the device's button state.

The documentation for this class was generated from the following files:

- SurgSim/Testing/VisualTestCommon/MovingSquareGlutWindow.h
- SurgSim/Testing/VisualTestCommon/MovingSquareGlutWindow.cpp