Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef RVIZ_VIEW_CONTROLLER_H
00031 #define RVIZ_VIEW_CONTROLLER_H
00032
00033 #include <string>
00034
00035 #include <QCursor>
00036
00037 #include "rviz/properties/property.h"
00038
00039 class QKeyEvent;
00040
00041 namespace Ogre
00042 {
00043 class Camera;
00044 class SceneNode;
00045 class Vector3;
00046 class Quaternion;
00047 }
00048
00049 namespace rviz
00050 {
00051 class DisplayContext;
00052 class EnumProperty;
00053 class RenderPanel;
00054 class ViewportMouseEvent;
00055 class FloatProperty;
00056 class BoolProperty;
00057
00058 class ViewController: public Property
00059 {
00060 Q_OBJECT
00061 public:
00062 ViewController();
00063 virtual ~ViewController();
00064
00070 void initialize( DisplayContext* context );
00071
00072 static QString formatClassId( const QString& class_id );
00073
00076 virtual QVariant getViewData( int column, int role ) const;
00077
00079 virtual Qt::ItemFlags getViewFlags( int column ) const;
00080
00085 void activate();
00086
00089 virtual void update(float dt, float ros_dt) {}
00090
00091 virtual void handleMouseEvent(ViewportMouseEvent& evt) {}
00092
00097 virtual void handleKeyEvent( QKeyEvent* event, RenderPanel* panel );
00098
00100 void lookAt( float x, float y, float z );
00101
00105 virtual void lookAt( const Ogre::Vector3& point ) {}
00106
00109 virtual void reset() = 0;
00110
00118 virtual void mimic( ViewController* source_view ) {}
00119
00128 virtual void transitionFrom( ViewController* previous_view ) {}
00129
00131 void emitConfigChanged();
00132
00133 Ogre::Camera* getCamera() const { return camera_; }
00134
00138 virtual QString getClassId() const { return class_id_; }
00139
00142 virtual void setClassId( const QString& class_id ) { class_id_ = class_id; }
00143
00144 virtual void load( const Config& config );
00145 virtual void save( Config config ) const;
00146
00147 bool isActive() const { return is_active_; }
00148
00150 virtual QCursor getCursor() { return cursor_; }
00151
00152 Q_SIGNALS:
00153 void configChanged();
00154
00155 private Q_SLOTS:
00156
00157 void updateNearClipDistance();
00158 void updateStereoProperties();
00159
00160 protected:
00164 virtual void onInitialize() {}
00165
00170 virtual void onActivate() {}
00171
00172
00173 enum CursorType{ Default, Rotate2D, Rotate3D, MoveXY, MoveZ, Zoom, Crosshair };
00174 void setCursor( CursorType cursor_type );
00175
00176
00177 void setCursor( QCursor cursor ) { cursor_=cursor; }
00178
00179 DisplayContext* context_;
00180 Ogre::Camera* camera_;
00181
00182 bool is_active_;
00183
00184
00185
00186
00187 QCursor cursor_;
00188
00189 FloatProperty* near_clip_property_;
00190 BoolProperty* stereo_enable_;
00191 BoolProperty* stereo_eye_swap_;
00192 FloatProperty* stereo_eye_separation_;
00193 FloatProperty* stereo_focal_distance_;
00194
00195 void setStatus( const QString & message );
00196
00197 private:
00198
00199 EnumProperty* type_property_;
00200 QString class_id_;
00201
00202
00203 QMap<CursorType,QCursor> standard_cursors_;
00204 };
00205
00206 }
00207
00208 #endif // RVIZ_VIEW_CONTROLLER_H