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
|
icestormguielement2d.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_ICESTORM_GUIELEMENT_2D_H 00012 #define ORCAGUI_ICESTORM_GUIELEMENT_2D_H 00013 00014 #include <orcaqguielementutil/icestormelement.h> 00015 #include <hydroqguielementutil/guielement2d.h> 00016 00017 namespace orcaqguielementutil { 00018 00019 template<class PainterType, class DataType, class ProxyType, class ConsumerType, class ConsumerPrxType> 00020 class 00021 IceStormGuiElement2d : public hydroqguielementutil::GuiElement2d, 00022 public IceStormElement<DataType,ProxyType,ConsumerType,ConsumerPrxType> 00023 { 00024 public: 00025 00028 IceStormGuiElement2d( const hydroqguielementutil::GuiElementInfo &guiElementInfo, 00029 const orcaice::Context &context, 00030 PainterType &painter, 00031 const double timeoutMs = 5000.0 ) 00032 : GuiElement2d(guiElementInfo), 00033 IceStormElement<DataType,ProxyType,ConsumerType,ConsumerPrxType>(context,guiElementInfo.uniqueId.toStdString(),timeoutMs), 00034 painter_(painter) 00035 {} 00036 00037 // From GuiElement 00038 virtual void update(); 00039 00040 // from GuiElement2d 00042 virtual void paint( QPainter *p, int z ) 00043 { painter_.paint( p, z ); } 00044 00045 virtual bool paintThisLayer( int z ) const 00046 { return painter_.paintThisLayer( z ); } 00047 00048 protected: 00049 00051 PainterType &painter_; 00052 }; 00053 00054 template<class PainterType, class DataType, class ProxyType, class ConsumerType, class ConsumerPrxType> 00055 void IceStormGuiElement2d<PainterType,DataType,ProxyType,ConsumerType,ConsumerPrxType>::update() 00056 { 00057 if (IceStormElement<DataType,ProxyType,ConsumerType,ConsumerPrxType>::shouldClearPainter_) 00058 { 00059 painter_.clear(); 00060 IceStormElement<DataType,ProxyType,ConsumerType,ConsumerPrxType>::shouldClearPainter_ = false; 00061 } 00062 00063 if (IceStormElement<DataType, 00064 ProxyType, 00065 ConsumerType, 00066 ConsumerPrxType>::updateFromStore() ) 00067 { 00068 // transfer data into painter 00069 painter_.setData( IceStormElement<DataType,ProxyType,ConsumerType,ConsumerPrxType>::data_ ); 00070 } 00071 } 00072 00073 00074 } 00075 00076 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)