From 51118c8bd9c04bb3cc0b963e5a2cf41a4fad68e6 Mon Sep 17 00:00:00 2001
From: Paul Novotny <pnovotny@simquest.com>
Date: Mon, 6 Oct 2014 11:48:37 -0400
Subject: [PATCH 1/2] Switch to Sixense device in Stapling Example

Switch the input device from Multiaxis to the Sixense device in the
stapling examples.
---
 Examples/CMakeLists.txt                  | 5 ++++-
 Examples/Stapling/CMakeLists.txt         | 5 ++++-
 Examples/Stapling/SerializedStapling.cpp | 9 ++++-----
 Examples/Stapling/Stapling.cpp           | 9 ++++-----
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt
index fb9dd05..89d1e86 100644
--- a/Examples/CMakeLists.txt
+++ b/Examples/CMakeLists.txt
@@ -15,9 +15,12 @@
 
 if(BUILD_DEVICE_MULTIAXIS)
 	add_subdirectory(AddSphereFromInput)
-	add_subdirectory(Stapling)
 endif(BUILD_DEVICE_MULTIAXIS)
 
+if(BUILD_DEVICE_SIXENSE)
+	add_subdirectory(Stapling)
+endif(BUILD_DEVICE_SIXENSE)
+
 if(BUILD_DEVICE_MULTIAXIS OR BUILD_DEVICE_NOVINT)
 	add_subdirectory(InputVtc)
 endif(BUILD_DEVICE_MULTIAXIS OR BUILD_DEVICE_NOVINT)
diff --git a/Examples/Stapling/CMakeLists.txt b/Examples/Stapling/CMakeLists.txt
index 5823ab3..d2146c6 100644
--- a/Examples/Stapling/CMakeLists.txt
+++ b/Examples/Stapling/CMakeLists.txt
@@ -13,6 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+find_package(SixenseSdk REQUIRED)
+
 include_directories(
 	${CMAKE_CURRENT_SOURCE_DIR}
 	${OSG_INCLUDE_DIR}
@@ -46,10 +48,11 @@ surgsim_show_ide_folders("Main.cpp SerializedMain.cpp ${SOURCES}" "${HEADERS}")
 
 set(LIBS 
 	IdentityPoseDevice
-	MultiAxisDevice
+	SixenseDevice
 	SurgSimBlocks
 	SurgSimFramework
 	SurgSimGraphics
+	${SIXENSE_SDK_LIBRARIES}
 	${YAML_CPP_LIBRARIES}
 )
 target_link_libraries(Stapling ${LIBS})
diff --git a/Examples/Stapling/SerializedStapling.cpp b/Examples/Stapling/SerializedStapling.cpp
index 8cf4974..452ea5e 100644
--- a/Examples/Stapling/SerializedStapling.cpp
+++ b/Examples/Stapling/SerializedStapling.cpp
@@ -19,7 +19,7 @@
 #include "SurgSim/Blocks/KeyboardTogglesComponentBehavior.h"
 #include "SurgSim/Blocks/TransferPhysicsToGraphicsMeshBehavior.h"
 #include "SurgSim/Blocks/VisualizeContactsBehavior.h"
-#include "SurgSim/Devices/MultiAxis/MultiAxisDevice.h"
+#include "SurgSim/Devices/Sixense/SixenseDevice.h"
 #include "SurgSim/Framework/BasicSceneElement.h"
 #include "SurgSim/Framework/BehaviorManager.h"
 #include "SurgSim/Framework/FrameworkConvert.h"
@@ -39,7 +39,7 @@
 #include "SurgSim/Physics/VirtualToolCoupler.h"
 
 using SurgSim::Device::IdentityPoseDevice;
-using SurgSim::Device::MultiAxisDevice;
+using SurgSim::Device::SixenseDevice;
 using SurgSim::Framework::BehaviorManager;
 using SurgSim::Framework::Runtime;
 using SurgSim::Framework::SceneElement;
@@ -66,8 +66,6 @@ std::shared_ptr<Type> getComponentChecked(std::shared_ptr<SurgSim::Framework::Sc
 
 int main(int argc, char* argv[])
 {
-	const std::string deviceName = "MultiAxisDevice";
-
 	std::shared_ptr<BehaviorManager> behaviorManager = std::make_shared<BehaviorManager>();
 	std::shared_ptr<OsgManager> graphicsManager = std::make_shared<OsgManager>();
 	std::shared_ptr<InputManager> inputManager = std::make_shared<InputManager>();
@@ -79,8 +77,9 @@ int main(int argc, char* argv[])
 	runtime->addManager(inputManager);
 	runtime->addManager(physicsManager);
 
+	const std::string deviceName = "StaplerDevice";
 	std::shared_ptr<DeviceInterface> device;
-	device = std::make_shared<MultiAxisDevice>(deviceName);
+	device = std::make_shared<SixenseDevice>(deviceName);
 	if (!device->initialize())
 	{
 		SURGSIM_LOG_WARNING(SurgSim::Framework::Logger::getDefaultLogger())
diff --git a/Examples/Stapling/Stapling.cpp b/Examples/Stapling/Stapling.cpp
index 6b8fcd7..e22e8a8 100644
--- a/Examples/Stapling/Stapling.cpp
+++ b/Examples/Stapling/Stapling.cpp
@@ -23,7 +23,7 @@
 #include "SurgSim/Collision/ShapeCollisionRepresentation.h"
 #include "SurgSim/Devices/IdentityPoseDevice/IdentityPoseDevice.h"
 #include "SurgSim/Devices/Keyboard/KeyCode.h"
-#include "SurgSim/Devices/MultiAxis/MultiAxisDevice.h"
+#include "SurgSim/Devices/Sixense/SixenseDevice.h"
 #include "SurgSim/Framework/ApplicationData.h"
 #include "SurgSim/Framework/BasicSceneElement.h"
 #include "SurgSim/Framework/BehaviorManager.h"
@@ -61,7 +61,7 @@ using SurgSim::Blocks::TransferPhysicsToGraphicsMeshBehavior;
 using SurgSim::Blocks::VisualizeContactsBehavior;
 using SurgSim::Collision::ShapeCollisionRepresentation;
 using SurgSim::Device::IdentityPoseDevice;
-using SurgSim::Device::MultiAxisDevice;
+using SurgSim::Device::SixenseDevice;
 using SurgSim::Framework::BasicSceneElement;
 using SurgSim::Framework::BehaviorManager;
 using SurgSim::Framework::Runtime;
@@ -384,8 +384,6 @@ std::shared_ptr<SurgSim::Graphics::OsgMaterial> createShinyMaterial(
 
 int main(int argc, char* argv[])
 {
-	const std::string deviceName = "MultiAxisDevice";
-
 	std::shared_ptr<BehaviorManager> behaviorManager = std::make_shared<BehaviorManager>();
 	std::shared_ptr<OsgManager> graphicsManager = std::make_shared<OsgManager>();
 	std::shared_ptr<InputManager> inputManager = std::make_shared<InputManager>();
@@ -399,7 +397,8 @@ int main(int argc, char* argv[])
 	runtime->addManager(physicsManager);
 
 	std::shared_ptr<DeviceInterface> device;
-	device = std::make_shared<MultiAxisDevice>(deviceName);
+	const std::string deviceName = "StaplerDevice";
+	device = std::make_shared<SixenseDevice>(deviceName);
 	if (!device->initialize())
 	{
 		SURGSIM_LOG_WARNING(SurgSim::Framework::Logger::getDefaultLogger())
-- 
2.1.0

