RGBColor.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef RGBColor_h
00020 #define RGBColor_h
00021
00022
00023
00024
00025
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031
00032 #include <iostream>
00033 #include <utils/common/UtilExceptions.h>
00034
00035
00036
00037
00038
00044 class RGBColor {
00045 public:
00048 RGBColor() throw();
00049
00050
00056 RGBColor(SUMOReal red, SUMOReal green, SUMOReal blue) throw();
00057
00058
00061 RGBColor(const RGBColor &col) throw();
00062
00063
00065 ~RGBColor() throw();
00066
00067
00068
00072 SUMOReal red() const throw() {
00073 return myRed;
00074 }
00075
00076
00080 SUMOReal green() const throw() {
00081 return myGreen;
00082 }
00083
00084
00088 SUMOReal blue() const throw() {
00089 return myBlue;
00090 }
00091
00092
00098 void set(SUMOReal r, SUMOReal g, SUMOReal b) throw();
00099
00100
00106 friend std::ostream &operator<<(std::ostream &os, const RGBColor &col);
00107
00108
00109 bool operator==(const RGBColor &c) const;
00110 bool operator!=(const RGBColor &c) const;
00111
00112
00122 static RGBColor parseColor(const std::string &coldef) throw(EmptyData, NumberFormatException);
00123
00124
00138 static RGBColor parseColorReporting(const std::string &coldef, const char *objecttype, const char *objectid, bool report, bool &ok) throw();
00139
00140
00144 static RGBColor getDefaultColor() throw();
00145
00146
00157 static RGBColor interpolate(const RGBColor &minColor, const RGBColor &maxColor, SUMOReal weight) throw();
00158
00159
00167 static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v) throw();
00168
00169
00171 static const std::string DEFAULT_COLOR_STRING;
00172
00173
00175 static const RGBColor DEFAULT_COLOR;
00176
00177
00178 private:
00180 SUMOReal myRed, myGreen, myBlue;
00181
00182 };
00183
00184
00185 #endif
00186
00187
00188