opensurgsim
TrackIRDevice.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_DEVICES_TRACKIR_TRACKIRDEVICE_H
17 #define SURGSIM_DEVICES_TRACKIR_TRACKIRDEVICE_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "SurgSim/Input/CommonDevice.h"
23 
24 namespace SurgSim
25 {
26 namespace Devices
27 {
28 class TrackIRScaffold;
29 
30 SURGSIM_STATIC_REGISTRATION(TrackIRDevice);
31 
45 {
46 public:
49  explicit TrackIRDevice(const std::string& uniqueName);
50 
51  SURGSIM_CLASSNAME(SurgSim::Devices::TrackIRDevice);
52 
54  virtual ~TrackIRDevice();
55 
56  bool initialize() override;
57 
58  bool isInitialized() const override;
59 
63  void setPositionScale(double scale);
65  double getPositionScale() const;
66 
70  void setOrientationScale(double scale);
72  double getOrientationScale() const;
73 
74 private:
75  friend class TrackIRScaffold;
76 
77  bool finalize() override;
78 
79  // Returns the default position scale
80  static double defaultPositionScale();
81  // Returns the default rotation scale
82  static double defaultOrientationScale();
83 
85  double m_positionScale;
87  double m_orientationScale;
88 
90  std::shared_ptr<TrackIRScaffold> m_scaffold;
91 };
92 
93 }; // namespace Devices
94 }; // namespace SurgSim
95 
96 #endif // SURGSIM_DEVICES_TRACKIR_TRACKIRDEVICE_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
A class that manages Natural Point TRACKIR devices.
Definition: TrackIRScaffold.h:38
bool isInitialized() const override
Definition: TrackIRDevice.cpp:66
bool initialize() override
Fully initialize the device.
Definition: TrackIRDevice.cpp:43
A class implementing the communication with Natural Point TrackIR camera.
Definition: TrackIRDevice.h:44
double getPositionScale() const
Gets the position scale for this device.
Definition: TrackIRDevice.cpp:81
virtual ~TrackIRDevice()
Destructor.
Definition: TrackIRDevice.cpp:35
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
void setPositionScale(double scale)
Sets the position scale for this device.
Definition: TrackIRDevice.cpp:72
TrackIRDevice(const std::string &uniqueName)
Constructor.
Definition: TrackIRDevice.cpp:28
void setOrientationScale(double scale)
Sets the orientation scale for this device.
Definition: TrackIRDevice.cpp:87
double getOrientationScale() const
Gets the orientation scale for this device.
Definition: TrackIRDevice.cpp:96