orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
paintutils.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 HYDROQGUI_PAINT_UTILS_H 00012 #define HYDROQGUI_PAINT_UTILS_H 00013 00014 #include <QColor> 00015 #include <QPolygonF> 00016 #include <QPainter> 00017 00018 // 00019 // Generally useful tools that are used by several 00020 // painters. 00021 // 00022 // Authors: Alex Brooks, Tobias Kaupp 00023 // 00024 namespace hydroqguielementutil 00025 { 00026 00030 class PoseHistory 00031 { 00032 public: 00033 00034 PoseHistory( double lineThickness=2.0 ); 00035 00036 // Add a point (units: metres) 00037 void addPoint( const double x, const double y ); 00038 00039 void paint( QPainter *p, const QColor &c ); 00040 00041 private: 00042 00043 QVector<QPolygonF> histories_; 00044 double lineThickness_; // in pixel 00045 int totalPoints_; 00046 }; 00047 00049 00057 class ScopedSaver { 00058 00059 public: 00060 ScopedSaver( QPainter *p ) 00061 : p_(p) 00062 { p_->save(); } 00063 ~ScopedSaver() 00064 { p_->restore(); } 00065 private: 00066 QPainter *p_; 00067 }; 00068 00069 00071 void paintOrigin( QPainter *p, 00072 const QColor &colour, 00073 float radius, 00074 float lineThickness=0.2 ); 00075 00080 void paintCubicPlatformPose( QPainter *p, 00081 float length, 00082 float width, 00083 float transparencyMultiplier=1.0, 00084 float minLength=0.0 ); 00085 00087 void paintCylindricalPlatformPose( QPainter *p, 00088 float radius, 00089 float transparencyMultiplier=1.0, 00090 float minRadius=0.0 ); 00091 00093 void paintUncertaintyWedge( QPainter *p, 00094 float ptt, 00095 float length ); 00096 00098 void paintCovarianceEllipse( QPainter *p, 00099 float pxx, 00100 float pxy, 00101 float pyy ); 00102 00105 QColor getTransparentVersion( const QColor &c, 00106 float transparencyMultiplier=0.5 ); 00107 00109 QColor getDarkVersion( const QColor &color ); 00110 00112 void paintWaypoint( QPainter *p, 00113 const QColor &fillColor, 00114 const QColor &drawColor, 00115 int targetHeading, 00116 float distanceTolerance, 00117 int headingTolerance ); 00118 00119 void paintArrow( QPainter *p ); 00120 00121 } 00122 00123 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)