render_panel.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef RVIZ_RENDER_PANEL_H
31 #define RVIZ_RENDER_PANEL_H
32 
34 
35 #ifndef Q_MOC_RUN
36 #include <OgreSceneManager.h>
37 
38 #include <boost/thread/mutex.hpp>
39 #endif
40 
41 #include <vector>
42 #include <map>
43 
44 namespace Ogre
45 {
46 class Root;
47 class Camera;
48 class RaySceneQuery;
49 class ParticleSystem;
50 }
51 
52 namespace ros
53 {
54 class Node;
55 }
56 
57 class QMenu;
58 class QKeyEvent;
59 class PropertyTreeWidget;
60 
61 namespace rviz
62 {
63 
64 class Display;
65 class DisplayContext;
66 class ViewController;
67 
75 class RenderPanel: public QtOgreRenderWindow, public Ogre::SceneManager::Listener
76 {
77 Q_OBJECT
78 public:
80  RenderPanel( QWidget* parent = 0 );
81  virtual ~RenderPanel();
82 
84  void initialize(Ogre::SceneManager* scene_manager, DisplayContext* manager);
85 
86  DisplayContext* getManager() { return context_; }
87 
88  ViewController* getViewController() { return view_controller_; }
89 
92  void setViewController( ViewController* controller );
93 
96  void showContextMenu( boost::shared_ptr<QMenu> menu );
97 
99  bool contextMenuVisible();
100 
101  virtual void sceneManagerDestroyed( Ogre::SceneManager* source );
102 
103 protected:
104  // Override from QWidget
105  void contextMenuEvent( QContextMenuEvent* event );
106 
108  void onRenderWindowMouseEvents( QMouseEvent* event );
109 
110  // QWidget mouse events all get sent to onRenderWindowMouseEvents().
111  // QMouseEvent.type() distinguishes them later.
112  virtual void mouseMoveEvent( QMouseEvent* event ) { onRenderWindowMouseEvents( event ); }
113  virtual void mousePressEvent( QMouseEvent* event ) { onRenderWindowMouseEvents( event ); }
114  virtual void mouseReleaseEvent( QMouseEvent* event ) { onRenderWindowMouseEvents( event ); }
115  virtual void mouseDoubleClickEvent( QMouseEvent* event ) { onRenderWindowMouseEvents( event ); }
116 
117  virtual void leaveEvent ( QEvent * event );
118 
120  virtual void wheelEvent( QWheelEvent* event );
121 
122  virtual void keyPressEvent( QKeyEvent* event );
123 
124  // Mouse handling
125  int mouse_x_;
126  int mouse_y_;
127 
129  Ogre::SceneManager* scene_manager_;
130 
132 
134  boost::mutex context_menu_mutex_;
135 
137 
138  // Pointer to the Display which is using this render panel, or NULL
139  // if this does not belong to a Display.
141 
142 private Q_SLOTS:
143  void sendMouseMoveEvent();
144  void onContextMenuHide();
145 
146 private:
148  Ogre::Camera* default_camera_;
149 };
150 
151 } // namespace rviz
152 
153 #endif
154 
DisplayContext * getManager()
Definition: render_panel.h:86
ViewController * view_controller_
Definition: render_panel.h:131
ViewController * getViewController()
Definition: render_panel.h:88
ROSCONSOLE_DECL void initialize()
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: render_panel.h:112
Ogre::SceneManager * scene_manager_
Definition: render_panel.h:129
virtual void mousePressEvent(QMouseEvent *event)
Definition: render_panel.h:113
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition: render_panel.h:114
virtual void mouseDoubleClickEvent(QMouseEvent *event)
Definition: render_panel.h:115
Pure-virtual base class for objects which give Display subclasses context in which to work...
int mouse_y_
Y position of the last mouse event.
Definition: render_panel.h:126
DisplayContext * context_
Definition: render_panel.h:128
QTimer * fake_mouse_move_event_timer_
Definition: render_panel.h:147
int mouse_x_
X position of the last mouse event.
Definition: render_panel.h:125
Display * display_
Definition: render_panel.h:140
boost::shared_ptr< QMenu > context_menu_
Definition: render_panel.h:133
boost::mutex context_menu_mutex_
Definition: render_panel.h:134
Ogre::Camera * default_camera_
A default camera created in initialize().
Definition: render_panel.h:148


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Wed Aug 28 2019 04:01:51