SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RGBColor.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A RGB-color definition
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef RGBColor_h
23 #define RGBColor_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <iostream>
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
47 class RGBColor {
48 public:
51  RGBColor() ;
52 
53 
60 
61 
64  RGBColor(const RGBColor& col) ;
65 
66 
68  ~RGBColor() ;
69 
70 
71 
75  SUMOReal red() const {
76  return myRed;
77  }
78 
79 
83  SUMOReal green() const {
84  return myGreen;
85  }
86 
87 
91  SUMOReal blue() const {
92  return myBlue;
93  }
94 
95 
101  void set(SUMOReal r, SUMOReal g, SUMOReal b) ;
102 
103 
109  friend std::ostream& operator<<(std::ostream& os, const RGBColor& col);
110 
111 
112  bool operator==(const RGBColor& c) const;
113  bool operator!=(const RGBColor& c) const;
114 
115 
121 
122 
132  static RGBColor parseColor(const std::string& coldef) throw(EmptyData, NumberFormatException);
133 
134 
148  static RGBColor parseColorReporting(const std::string& coldef, const std::string& objecttype,
149  const char* objectid, bool report, bool& ok) ;
150 
151 
155  static RGBColor getDefaultColor() ;
156 
157 
168  static RGBColor interpolate(const RGBColor& minColor, const RGBColor& maxColor, SUMOReal weight) ;
169 
170 
178  static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v) ;
179 
180 
182  static const std::string DEFAULT_COLOR_STRING;
183 
184 
186  static const RGBColor DEFAULT_COLOR;
187 
188 
189 private:
192 
193 };
194 
195 
196 #endif
197 
198 /****************************************************************************/
199