ViewElement.h
Go to the documentation of this file.
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_GRAPHICS_VIEWELEMENT_H
17 #define SURGSIM_GRAPHICS_VIEWELEMENT_H
18 
20 
21 namespace SurgSim
22 {
23 
24 namespace Input
25 {
26 class CommonDevice;
27 }
28 
29 namespace Graphics
30 {
31 
32 class Camera;
33 class View;
34 
40 {
41 public:
44  explicit ViewElement(const std::string& name);
45 
47  virtual ~ViewElement();
48 
51  virtual bool setView(std::shared_ptr<View> view);
52 
55  std::shared_ptr<View> getView();
56 
59  void setCamera(std::shared_ptr<Camera> camera);
60 
63  std::shared_ptr<Camera> getCamera();
64 
67  virtual std::shared_ptr<SurgSim::Input::CommonDevice> getKeyboardDevice() = 0;
68 
71  virtual void enableKeyboardDevice(bool val) = 0;
72 
75  virtual std::shared_ptr<SurgSim::Input::CommonDevice> getMouseDevice() = 0;
76 
79  virtual void enableMouseDevice(bool val) = 0;
80 
81 protected:
84  bool doInitialize() override;
85 
86 private:
88  std::shared_ptr<View> m_view;
89 
91  std::shared_ptr<Camera> m_camera;
92 };
93 
94 }; // namespace Graphics
95 }; // namespace SurgSim
96 
97 #endif // SURGSIM_GRAPHICS_VIEWELEMENT_H
SurgSim::Graphics::ViewElement::m_view
std::shared_ptr< View > m_view
View component that provides the visualization of the graphics representations.
Definition: ViewElement.h:88
SurgSim::Graphics::ViewElement::~ViewElement
virtual ~ViewElement()
Destructor.
Definition: ViewElement.cpp:30
SurgSim::Graphics::ViewElement::setView
virtual bool setView(std::shared_ptr< View > view)
Sets the view component that provides the visualization of the graphics representations.
Definition: ViewElement.cpp:34
SurgSim::Graphics::ViewElement::getView
std::shared_ptr< View > getView()
Returns the view component that provides the visualization of the graphics representations.
Definition: ViewElement.cpp:44
SurgSim::Framework::BasicSceneElement
Simple concrete implementation of a scene element that does not have any higher logic.
Definition: BasicSceneElement.h:30
SurgSim::Graphics::ViewElement::getKeyboardDevice
virtual std::shared_ptr< SurgSim::Input::CommonDevice > getKeyboardDevice()=0
Return the keyboard to be used with this view.
SurgSim::Graphics::ViewElement::enableMouseDevice
virtual void enableMouseDevice(bool val)=0
Turn on/off the mouse device to be used.
BasicSceneElement.h
SurgSim::Graphics::ViewElement::enableKeyboardDevice
virtual void enableKeyboardDevice(bool val)=0
Turn on/off the keyboard device to be used.
SurgSim::Graphics::ViewElement::m_camera
std::shared_ptr< Camera > m_camera
Camera component connected to the view.
Definition: ViewElement.h:91
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Graphics::ViewElement::ViewElement
ViewElement(const std::string &name)
Constructor.
Definition: ViewElement.cpp:26
SurgSim::Graphics::ViewElement::doInitialize
bool doInitialize() override
Initializes the scene element.
Definition: ViewElement.cpp:59
SurgSim::Graphics::ViewElement::setCamera
void setCamera(std::shared_ptr< Camera > camera)
Sets the camera for the view in this sceneelement.
Definition: ViewElement.cpp:49
SurgSim::Graphics::ViewElement
Basic SceneElement that wraps a View so that it can be added to the Scene.
Definition: ViewElement.h:40
SurgSim::Graphics::ViewElement::getMouseDevice
virtual std::shared_ptr< SurgSim::Input::CommonDevice > getMouseDevice()=0
Return the mouse to be used with this view.
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Graphics::ViewElement::getCamera
std::shared_ptr< Camera > getCamera()
Get the camera for the view in this sceneelement.
Definition: ViewElement.cpp:54