orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
worldview.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Ben Upcroft 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef HYDROQGUI_WORLDVIEW_H 00012 #define HYDROQGUI_WORLDVIEW_H 00013 00014 #include <QMouseEvent> 00015 #include <QFileDialog> 00016 #include <QString> 00017 00018 #include <hydroqgui/zoomwidget.h> 00019 #include <hydroqgui/hydroqgui.h> 00020 00021 00022 namespace hydroqgui { 00023 00024 class PlatformCSFinder; 00025 00029 class WorldView : public hydroqgui::ZoomWidget 00030 { 00031 Q_OBJECT 00032 public: 00033 00034 struct Config { 00035 Config() 00036 : initWithTransparency(false), 00037 initWithAntiAliasing(false) 00038 {} 00039 00040 bool initWithTransparency; 00041 bool initWithAntiAliasing; 00042 }; 00043 00044 WorldView( PlatformCSFinder *platformCSFinder, 00045 ::hydroqguielementutil::MouseEventManager &mouseEventManager, 00046 GuiElementSet &guiElementSet, 00047 CoordinateFrameManager &coordinateFrameManager, 00048 ::hydroqguielementutil::IHumanManager &humanManager, 00049 PlatformFocusManager &platformFocusManager, 00050 int displayRefreshTime, 00051 const Config &cfg=Config(), 00052 QWidget *parent = NULL ); 00053 ~WorldView(); 00054 00055 QSize sizeHint() const { return QSize( 400, 400 ); } 00056 00057 public slots: 00058 // abstract zoom functions 00059 void zoomFitWin(); 00060 void zoomAllPix(); 00061 void setAntiAliasing(bool antiAliasing); 00062 void setUseTransparency(bool useTransparency); 00063 00064 private slots: 00065 00066 void updateAllGuiElements(); 00067 00068 private: 00069 00070 void printStatusMessage(bool antiAliasing); 00071 void setupInterface( const Config &cfg ); 00072 00073 // finds coord system of a platform 00074 PlatformCSFinder *platformCSFinder_; 00075 00076 // handles distribution of mouse events to GuiElements 00077 ::hydroqguielementutil::MouseEventManager &mouseEventManager_; 00078 00079 GuiElementSet &guiElementSet_; 00080 CoordinateFrameManager &coordinateFrameManager_; 00081 00082 ::hydroqguielementutil::IHumanManager &humanManager_; 00083 PlatformFocusManager &platformFocusManager_; 00084 00085 void paintAllGuiElements( QPainter *painter, int z, bool isCoordinateFramePlatformLocalised ); 00086 00087 // finds the nearest platform to the click, pclick and pixelRadius are in window CS 00088 QString nearestComponent( const QPointF& pclick, const double & pixelRadius ); 00089 00090 // Returns true if the platform which owns the coordinate system is localised 00091 // or if "global" owns the coordinate system 00092 bool transformToPlatformOwningCS( QPainter *p ); 00093 00094 // event handlers 00095 void paintEvent( QPaintEvent* paintEvent ); 00096 void mousePressEvent( QMouseEvent* ); 00097 void mouseMoveEvent( QMouseEvent* ); 00098 void mouseReleaseEvent( QMouseEvent* ); 00099 void mouseDoubleClickEvent( QMouseEvent* ); 00100 00101 QPointF mouseDownPnt_; 00102 QPointF mouseMovePnt_; 00103 00104 QPoint prevDragPos_; 00105 00106 bool antiAliasing_; 00107 00108 QTimer *displayTimer_; 00109 }; 00110 00111 } 00112 00113 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)