All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UserCamera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
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 */
17 /* Desc: Camera for viewing the world
18  * Author: Nate Koenig
19  * Date: 19 Jun 2008
20  */
21 
22 #ifndef _USERCAMERA_HH_
23 #define _USERCAMERA_HH_
24 
25 #include <string>
26 #include <vector>
27 
31 #include "gazebo/util/system.hh"
32 
33 namespace gazebo
34 {
35  class UserCameraPrivate;
36 
37  namespace rendering
38  {
39  class GUIOverlay;
40 
43 
47  {
51  public: UserCamera(const std::string &_name, ScenePtr _scene);
52 
54  public: virtual ~UserCamera();
55 
58  public: void Load(sdf::ElementPtr _sdf);
59 
61  public: void Load();
62 
64  public: void Init();
65 
67  public: virtual void Update();
68 
70  public: virtual void PostRender();
71 
73  public: void Fini();
74 
77  public: virtual void SetWorldPose(const math::Pose &_pose);
78 
81  public: void HandleMouseEvent(const common::MouseEvent &_evt);
82 
85  public: void HandleKeyPressEvent(const std::string &_key);
86 
89  public: void HandleKeyReleaseEvent(const std::string &_key);
90 
93  public: void SetViewController(const std::string &_type);
94 
98  public: void SetViewController(const std::string &_type,
99  const math::Vector3 &_pos);
100 
103  public: std::string GetViewControllerTypeString();
104 
108  public: void Resize(unsigned int _w, unsigned int _h);
109 
115  public: void SetViewportDimensions(float _x, float _y,
116  float _w, float _h);
117 
120  public: float GetAvgFPS() const;
121 
124  public: unsigned int GetTriangleCount() const;
125 
128  public: void MoveToVisual(VisualPtr _visual);
129 
130  // Doxygen automatically pulls in the correct documentation.
131  public: virtual bool MoveToPosition(const math::Pose &_pose,
132  double _time);
133 
136  public: void MoveToVisual(const std::string &_visualName);
137 
142  public: virtual void SetRenderTarget(Ogre::RenderTarget *_target);
143 
148  public: GUIOverlay *GetGUIOverlay();
149 
155  public: void EnableViewController(bool _value) const;
156 
162  public: VisualPtr GetVisual(const math::Vector2i &_mousePos,
163  std::string &_mod);
164 
167  public: VisualPtr GetVisual(const math::Vector2i &_mousePos) const;
168 
171  public: void SetFocalPoint(const math::Vector3 &_pt);
172 
173  // Documentation inherited
174  public: virtual unsigned int GetImageWidth() const;
175 
176  // Documentation inherited
177  public: virtual unsigned int GetImageHeight() const;
178 
181  public: bool IsCameraSetInWorldFile();
182 
185  public: void SetUseSDFPose(bool _value);
186 
198  protected: virtual bool AttachToVisualImpl(VisualPtr _visual,
199  bool _inheritOrientation, double _minDist = 0,
200  double _maxDist = 0);
201 
202  // Documentation inherited.
203  protected: virtual void AnimationComplete();
204 
210  protected: virtual bool TrackVisualImpl(VisualPtr _visual);
211 
212 
214  private: void ToggleShowVisual();
215 
219  private: void ShowVisual(bool _show);
220 
223  private: void OnMoveToVisualComplete();
224 
227  private: UserCameraPrivate *dataPtr;
228  };
230  }
231 }
232 #endif