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
|
paintutils.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 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 int maxNumPoints=1000 ); 00036 00037 // Add a point (units: metres) 00038 void addPoint( const double x, const double y ); 00039 00040 void paint( QPainter *p, const QColor &c ); 00041 00042 // Max length measured in size of array 00043 void setMaxNumPoints( int maxNumPoints ) 00044 { maxNumPoints_ = maxNumPoints; } 00045 int currentMaxNumPoints() const 00046 { return maxNumPoints_; } 00047 00048 private: 00049 00050 QVector<QPolygonF> histories_; 00051 double lineThickness_; // in pixel 00052 int totalPoints_; 00053 int maxNumPoints_; 00054 }; 00055 00057 00065 class ScopedSaver { 00066 00067 public: 00068 ScopedSaver( QPainter *p ) 00069 : p_(p) 00070 { p_->save(); } 00071 ~ScopedSaver() 00072 { p_->restore(); } 00073 private: 00074 QPainter *p_; 00075 }; 00076 00077 00079 void paintOrigin( QPainter *p, 00080 const QColor &colour, 00081 float radius, 00082 float lineThickness=0.2 ); 00083 00088 void paintCubicPlatformPose( QPainter *p, 00089 float length, 00090 float width, 00091 float transparencyMultiplier=1.0, 00092 float minLength=0.0 ); 00093 00095 void paintCylindricalPlatformPose( QPainter *p, 00096 float radius, 00097 float transparencyMultiplier=1.0, 00098 float minRadius=0.0 ); 00099 00101 void paintUncertaintyWedge( QPainter *p, 00102 float ptt, 00103 float length ); 00104 00106 void paintCovarianceEllipse( QPainter *p, 00107 float pxx, 00108 float pxy, 00109 float pyy ); 00110 00113 QColor getTransparentVersion( const QColor &c, 00114 float opacity=0.5 ); 00115 00117 QColor getDarkVersion( const QColor &color ); 00118 00120 void paintWaypoint( QPainter *p, 00121 const QColor &fillColor, 00122 const QColor &drawColor, 00123 int targetHeading, // Warning: Units are 16ths of degrees ! 00124 float distanceTolerance, 00125 int headingTolerance ); // Warning: Units are 16ths of degrees ! 00126 00127 void paintArrow( QPainter *p ); 00128 00133 double worldMatrixScale( QPainter *p ); 00134 00135 } 00136 00137 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)