|
orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca 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-2008 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 <orcaobj/orcaobj.h> 00015 #include <orcaice/orcaice.h> 00016 00017 #include <hydroqgui/hydroqgui.h> 00018 #include <orcaqgui3d/iknowsplatformposition.h> 00019 #include <orcaqgui3d/icestormelement3d.h> 00020 #include <orcaqgui3dfactory/localise2dpainter.h> 00021 00022 namespace orcaqgui3d 00023 { 00024 00025 class Localise2dElement 00026 : public orcaqgui3d::IceStormElement3d<Localise2dPainter, 00027 orca::Localise2dData, 00028 orca::Localise2dPrx, 00029 orca::Localise2dConsumer, 00030 orca::Localise2dConsumerPrx>, 00031 public orcaqgui3d::IKnowsPlatformPosition 00032 { 00033 public: 00034 Localise2dElement( const orcaice::Context &context, 00035 const std::string &proxyString, 00036 hydroqguielementutil::IHumanManager *humanManager, 00037 bool beginDisplayHistory=false, 00038 int timeoutMs=30000 ) 00039 : orcaqgui3d::IceStormElement3d<Localise2dPainter, 00040 orca::Localise2dData, 00041 orca::Localise2dPrx, 00042 orca::Localise2dConsumer, 00043 orca::Localise2dConsumerPrx>(context, proxyString, painter_, timeoutMs ), 00044 humanManager_(humanManager), 00045 painter_( beginDisplayHistory ), 00046 x_(0), 00047 y_(0), 00048 yaw_(0), 00049 haveGeometry_(false) 00050 {} 00051 00052 virtual bool isInGlobalCS() { return true; } 00053 virtual void actionOnConnection(); 00054 virtual QStringList contextMenu(); 00055 virtual void execute( int action ); 00056 00057 virtual void setColor( QColor color ) { painter_.setColor(color); } 00058 virtual void setFocus( bool inFocus ) { painter_.setFocus( inFocus ); }; 00059 virtual void setUseTransparency( bool useTransparency ) { painter_.setUseTransparency( useTransparency ); }; 00060 00061 // Need a special update function to set (x,y,z,roll,pitch,yaw) 00062 // The Localise2dElement needs this because it's special kind of GuiElement: 00063 // A platform has a position in the world and various other things are 00064 // drawn with respect to that position. 00065 virtual void update(); 00066 00067 // Access to ML estimate. 00068 virtual float x() const { return x_; } 00069 virtual float y() const { return y_; } 00070 // HACK: z hard-coded to 0.35 !!!!!!!!!!!!!!!!!!!!!!!!!!!! 00071 virtual float z() const { return 0.35; } 00072 virtual float roll() const { return 0.0; } 00073 virtual float pitch() const { return 0.0; } 00074 virtual float yaw() const { return yaw_; } 00075 virtual int platformKnowledgeReliability() const { return 7; } 00076 00077 osg::Node *osgNode() const { return painter_.osgNode(); } 00078 00079 private: 00080 00081 hydroqguielementutil::IHumanManager *humanManager_; 00082 Localise2dPainter painter_; 00083 00084 // We're visualising a 2D thing -- don't know z/roll/pitch 00085 double x_; 00086 double y_; 00087 double yaw_; 00088 00089 void tryToGetGeometry(); 00090 bool haveGeometry_; 00091 }; 00092 00093 } 00094 00095 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)
1.4.5