opensurgsim
LeapDevice.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2015, 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_LEAP_LEAPDEVICE_H
17 #define SURGSIM_DEVICES_LEAP_LEAPDEVICE_H
18 
19 #include <memory>
20 
21 #include "SurgSim/DataStructures/OptionalValue.h"
22 #include "SurgSim/Input/CommonDevice.h"
23 
24 
25 namespace SurgSim
26 {
27 namespace Devices
28 {
29 
30 class LeapScaffold;
31 
32 SURGSIM_STATIC_REGISTRATION(LeapDevice);
33 
34 enum HandType : SURGSIM_ENUM_TYPE;
35 
66 {
67 public:
70  explicit LeapDevice(const std::string& name);
71 
72  SURGSIM_CLASSNAME(SurgSim::Devices::LeapDevice);
73 
75  virtual ~LeapDevice();
76 
79  void setHandType(HandType type);
80 
83  HandType getHandType() const;
84 
91  void setUseHmdTrackingMode(bool useHmdTrackingMode);
92 
95  bool isUsingHmdTrackingMode() const;
96 
99  void setProvideImages(bool provideImages);
100 
103  bool isProvidingImages() const;
104 
105  bool initialize() override;
106 
107  bool isInitialized() const override;
108 
109 private:
110  friend class LeapScaffold;
111 
112  bool finalize() override;
113 
114  std::shared_ptr<LeapScaffold> m_scaffold;
115 
116  HandType m_handType;
117 
119  DataStructures::OptionalValue<bool> m_requestedHmdTrackingMode;
120 
122  bool m_isProvidingImages;
123 };
124 
125 };
126 };
127 
128 SURGSIM_SERIALIZABLE_ENUM(SurgSim::Devices::HandType, (HANDTYPE_LEFT)(HANDTYPE_RIGHT));
129 
130 #endif //SURGSIM_DEVICES_LEAP_LEAPDEVICE_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
LeapDevice(const std::string &name)
Constructor.
Definition: LeapDevice.cpp:31
bool initialize() override
Fully initialize the device.
Definition: LeapDevice.cpp:93
void setProvideImages(bool provideImages)
Set if the device should provide the stereo infrared images.
Definition: LeapDevice.cpp:82
void setUseHmdTrackingMode(bool useHmdTrackingMode)
Set the hand tracking mode to HMD This is a global setting that optimizes hand tracking based on the ...
Definition: LeapDevice.cpp:61
A class implementing the communication with one hand tracked by Leap Motion camera.
Definition: LeapDevice.h:65
A class that manages Leap devices.
Definition: LeapScaffold.h:41
bool isProvidingImages() const
Get if the device should provide the stereo infrared images.
Definition: LeapDevice.cpp:88
bool isInitialized() const override
Definition: LeapDevice.cpp:121
bool isUsingHmdTrackingMode() const
Is Using HMD Tracking Mode.
Definition: LeapDevice.cpp:70
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
HandType getHandType() const
Get the type of hand.
Definition: LeapDevice.cpp:56
virtual ~LeapDevice()
Destructor.
Definition: LeapDevice.cpp:43
void setHandType(HandType type)
Set the type of hand.
Definition: LeapDevice.cpp:51