 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
18 #ifndef GUIPropertyScheme_h
19 #define GUIPropertyScheme_h
49 const std::string& colName =
"",
const bool isFixed =
false,
double baseValue = 0,
57 addColor(baseColor, baseValue, colName);
68 bool setColor(
const std::string& name,
const T& color) {
69 std::vector<std::string>::iterator nameIt =
myNames.begin();
70 typename std::vector<T>::iterator colIt =
myColors.begin();
71 for (; nameIt !=
myNames.end(); ++nameIt, ++colIt) {
72 if (*nameIt == name) {
80 int addColor(
const T& color,
const double threshold,
const std::string& name =
"") {
81 typename std::vector<T>::iterator colIt =
myColors.begin();
82 std::vector<double>::iterator threshIt =
myThresholds.begin();
83 std::vector<std::string>::iterator nameIt =
myNames.begin();
85 while (threshIt !=
myThresholds.end() && (*threshIt) < threshold) {
114 typename std::vector<T>::const_iterator colIt =
myColors.begin() + 1;
115 std::vector<double>::const_iterator threshIt =
myThresholds.begin() + 1;
116 while (threshIt !=
myThresholds.end() && (*threshIt) <= value) {
126 double lowVal = *(threshIt - 1);
127 return interpolate(*(colIt - 1), *colIt, (value - lowVal) / ((*threshIt) - lowVal));
185 typename std::vector<T>::const_iterator colIt =
myColors.begin();
186 std::vector<double>::const_iterator threshIt =
myThresholds.begin();
187 std::vector<std::string>::const_iterator nameIt =
myNames.begin();
194 if ((*nameIt) !=
"") {
221 double interpolate(
const double& min,
const double& max,
double weight)
const {
222 return min + (max - min) * weight;
std::vector< std::string > myNames
double interpolate(const double &min, const double &max, double weight) const
specializations for GUIScaleScheme
static const RGBColor INVISIBLE
GUIPropertyScheme(const std::string &name, const T &baseColor, const std::string &colName="", const bool isFixed=false, double baseValue=0, RGBColor bgColor=RGBColor::INVISIBLE, GUIIcon icon=ICON_EMPTY)
Constructor.
void setColor(const int pos, const T &color)
Static storage of an output device and its base (abstract) implementation.
GUIPropertyScheme< double > GUIScaleScheme
GUIPropertyScheme< RGBColor > GUIColorScheme
std::vector< T > myColors
void removeColor(const int pos)
@ SUMO_ATTR_COLOR
A color information.
bool operator==(const GUIPropertyScheme &c) const
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
const std::vector< double > & getThresholds() const
RGBColor interpolate(const RGBColor &min, const RGBColor &max, double weight) const
specializations for GUIColorScheme
static RGBColor interpolate(const RGBColor &minColor, const RGBColor &maxColor, double weight)
Interpolates between two colors.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const std::vector< T > & getColors() const
std::string getTagName(std::vector< RGBColor >) const
bool setColor(const std::string &name, const T &color)
void setInterpolated(const bool interpolate, double interpolationStart=0.f)
bool myAllowNegativeValues
bool allowsNegativeValues() const
GUIIcon
An enumeration of icons used by the gui applications.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string & getName() const
void setAllowsNegativeValues(bool value)
int addColor(const T &color, const double threshold, const std::string &name="")
const std::vector< std::string > & getNames() const
std::vector< double > myThresholds
void setThreshold(const int pos, const double threshold)
bool isInterpolated() const
const T getColor(const double value) const
void save(OutputDevice &dev) const
std::string getTagName(std::vector< double >) const
const RGBColor & getBackgroundColor() const