INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
orcaqgui3dfactory/localise2delement.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 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 ORCAGUI_LOCALISE2D_GUI_ELEMENT_H 00012 #define ORCAGUI_LOCALISE2D_GUI_ELEMENT_H 00013 00014 #include <orcaice/context.h> 00015 00016 #include <orcaqgui3d/iknowsplatformposition.h> 00017 #include <orcaqgui3d/icestormelement3d.h> 00018 #include <orcaqgui3dfactory/localisepainter.h> 00019 00020 namespace orcaqgui3d 00021 { 00022 00023 class Localise2dElement 00024 : public orcaqgui3d::IceStormElement3d<LocalisePainter, 00025 orca::Localise2dData, 00026 orca::Localise2dPrx, 00027 orca::Localise2dConsumer, 00028 orca::Localise2dConsumerPrx>, 00029 public orcaqgui3d::IKnowsPlatformPosition 00030 { 00031 public: 00032 Localise2dElement( const hydroqguielementutil::GuiElementInfo &guiElementInfo, 00033 const orcaice::Context &context, 00034 bool beginDisplayHistory = false, 00035 int timeoutMs = 30000 ) 00036 : orcaqgui3d::IceStormElement3d<LocalisePainter, 00037 orca::Localise2dData, 00038 orca::Localise2dPrx, 00039 orca::Localise2dConsumer, 00040 orca::Localise2dConsumerPrx>( guiElementInfo, context, painter_, timeoutMs ), 00041 painter_( beginDisplayHistory ), 00042 x_(0), 00043 y_(0), 00044 yaw_(0), 00045 haveGeometry_(false) 00046 {} 00047 00048 virtual bool isInGlobalCS() { return true; } 00049 virtual void iceStormConnectedEvent(); 00050 virtual QStringList contextMenu(); 00051 virtual void execute( int action ); 00052 00053 virtual void setColor( QColor color ) { painter_.setColor(color); } 00054 virtual void setFocus( bool inFocus ) { painter_.setFocus( inFocus ); }; 00055 virtual void setUseTransparency( bool useTransparency ) { painter_.setUseTransparency( useTransparency ); }; 00056 00057 // Need a special update function to set (x,y,z,roll,pitch,yaw) 00058 // The Localise2dElement needs this because it's special kind of GuiElement: 00059 // A platform has a position in the world and various other things are 00060 // drawn with respect to that position. 00061 virtual void update(); 00062 00063 // Access to ML estimate. 00064 virtual float x() const { return x_; } 00065 virtual float y() const { return y_; } 00066 // HACK: z hard-coded to 0.35 !!!!!!!!!!!!!!!!!!!!!!!!!!!! 00067 virtual float z() const { return 0.35; } 00068 virtual float roll() const { return 0.0; } 00069 virtual float pitch() const { return 0.0; } 00070 virtual float yaw() const { return yaw_; } 00071 virtual int platformKnowledgeReliability() const { return 7; } 00072 00073 osg::Node *osgNode() const { return painter_.osgNode(); } 00074 00075 private: 00076 00077 LocalisePainter painter_; 00078 00079 // We're visualising a 2D thing -- don't know z/roll/pitch 00080 double x_; 00081 double y_; 00082 double yaw_; 00083 00084 void tryToGetGeometry(); 00085 bool haveGeometry_; 00086 }; 00087 00088 } 00089 00090 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)