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
|
stringtorandomcolormap.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 HYDRO_HYDROQGUI_STRING_TO_RANDOM_COLOR_MAP_H 00012 #define HYDRO_HYDROQGUI_STRING_TO_RANDOM_COLOR_MAP_H 00013 00014 #include <vector> 00015 #include <QColor> 00016 #include <map> 00017 #include <hydroqgui/istringtocolormap.h> 00018 00019 namespace hydroqgui 00020 { 00021 // Manages a mapping from strings to random colours. 00022 // Remembers colours that have previously been assigned. 00023 // Author: Tobias Kaupp, Alex Brooks 00024 class StringToRandomColorMap : public IStringToColorMap 00025 { 00026 public: 00027 StringToRandomColorMap(); 00028 ~StringToRandomColorMap() {}; 00029 00030 // gets the color for a given string, allocating a new one if necessary 00031 QColor getColor( const QString &str ); 00032 00033 private: 00034 00035 QColor generateRandomColor(); 00036 00037 std::map<QString, QColor> colorMap_; 00038 unsigned int colorCounter_; 00039 std::vector<QColor> colorVector_; 00040 00041 // AlexB: what's this seed gear for?? 00042 // unsigned int seed_; 00043 }; 00044 00045 00046 00047 } 00048 00049 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)