![]() |
SUMO - Simulation of Urban MObility
|
#include <RGBColor.h>

Public Member Functions | |
| unsigned char | alpha () const |
| Returns the alpha-amount of the color. More... | |
| unsigned char | blue () const |
| Returns the blue-amount of the color. More... | |
| RGBColor | changedBrightness (int change, int toChange=3) const |
| Returns a new color with altered brightness. More... | |
| unsigned char | green () const |
| Returns the green-amount of the color. More... | |
| RGBColor | invertedColor () const |
| obtain inverted of current RGBColor More... | |
| bool | operator!= (const RGBColor &c) const |
| bool | operator== (const RGBColor &c) const |
| unsigned char | red () const |
| Returns the red-amount of the color. More... | |
| RGBColor () | |
| Constructor. More... | |
| RGBColor (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255) | |
| Constructor. More... | |
| RGBColor (const RGBColor &col) | |
| Copy constructor. More... | |
| void | set (unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
| assigns new values More... | |
| ~RGBColor () | |
| Destructor. More... | |
Static Public Member Functions | |
| static RGBColor | fromHSV (double h, double s, double v) |
| Converts the given hsv-triplet to rgb. More... | |
| static RGBColor | interpolate (const RGBColor &minColor, const RGBColor &maxColor, double weight) |
| Interpolates between two colors. More... | |
| static RGBColor | parseColor (std::string coldef) |
| Parses a color information. More... | |
| static RGBColor | parseColorReporting (const std::string &coldef, const std::string &objecttype, const char *objectid, bool report, bool &ok) |
| Parses a color information. More... | |
Static Public Attributes | |
| static const RGBColor | DEFAULT_COLOR = RGBColor::YELLOW |
| The default color (for vehicle types and vehicles) More... | |
| static const std::string | DEFAULT_COLOR_STRING = toString(RGBColor::DEFAULT_COLOR) |
| The string description of the default color. More... | |
| static const RGBColor | RED = RGBColor(255, 0, 0, 255) |
| named colors More... | |
| static const RGBColor | GREEN = RGBColor(0, 255, 0, 255) |
| static const RGBColor | BLUE = RGBColor(0, 0, 255, 255) |
| static const RGBColor | YELLOW = RGBColor(255, 255, 0, 255) |
| static const RGBColor | CYAN = RGBColor(0, 255, 255, 255) |
| static const RGBColor | MAGENTA = RGBColor(255, 0, 255, 255) |
| static const RGBColor | ORANGE = RGBColor(255, 128, 0, 255) |
| static const RGBColor | WHITE = RGBColor(255, 255, 255, 255) |
| static const RGBColor | BLACK = RGBColor(0, 0, 0, 255) |
| static const RGBColor | GREY = RGBColor(128, 128, 128, 255) |
Private Attributes | |
| unsigned char | myAlpha |
| unsigned char | myBlue |
| unsigned char | myGreen |
| unsigned char | myRed |
| The color amounts. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const RGBColor &col) |
| Writes the color to the given stream. More... | |
The definition of a color in the RGB-space with an alpha channel. The cube is meant to lie between (0, 0, 0) and (255, 255, 255)
Definition at line 40 of file RGBColor.h.
| RGBColor::RGBColor | ( | ) |
Constructor.
Definition at line 60 of file RGBColor.cpp.
Referenced by fromHSV(), interpolate(), invertedColor(), parseColor(), and parseColorReporting().
| RGBColor::RGBColor | ( | unsigned char | red, |
| unsigned char | green, | ||
| unsigned char | blue, | ||
| unsigned char | alpha = 255 |
||
| ) |
Constructor.
| [in] | red | The red component's value |
| [in] | green | The green component's value |
| [in] | blue | The blue component's value |
Definition at line 64 of file RGBColor.cpp.
| RGBColor::RGBColor | ( | const RGBColor & | col | ) |
Copy constructor.
Definition at line 68 of file RGBColor.cpp.
| RGBColor::~RGBColor | ( | ) |
Destructor.
Definition at line 72 of file RGBColor.cpp.
|
inline |
Returns the alpha-amount of the color.
Definition at line 83 of file RGBColor.h.
References changedBrightness(), fromHSV(), interpolate(), invertedColor(), myAlpha, operator!=(), operator<<, operator==(), parseColor(), and parseColorReporting().
Referenced by GUILane::drawAsWaterway(), GLHelper::drawText(), GUIJunctionWrapper::getColorValue(), MFXUtils::getFXColor(), libsumo::Person::getLanePosition(), GUISUMOAbstractView::makeSnapshot(), libsumo::Helper::makeTraCIColor(), GUISUMOAbstractView::onConfigure(), GUISUMOAbstractView::paintGL(), GLHelper::setColor(), and BinaryFormatter::writeAttr().
|
inline |
Returns the blue-amount of the color.
Definition at line 76 of file RGBColor.h.
References myBlue.
Referenced by changedBrightness(), GUILane::drawAsWaterway(), GLHelper::drawText(), GUIParameterTracker::GUIParameterTrackerPanel::drawValue(), GUIJunctionWrapper::getColorValue(), MFXUtils::getFXColor(), libsumo::Person::getLanePosition(), GUISUMOAbstractView::makeSnapshot(), libsumo::Helper::makeTraCIColor(), GUISUMOAbstractView::onConfigure(), GUISUMOAbstractView::paintGL(), GLHelper::setColor(), and BinaryFormatter::writeAttr().
| RGBColor RGBColor::changedBrightness | ( | int | change, |
| int | toChange = 3 |
||
| ) | const |
Returns a new color with altered brightness.
| [in] | change | The absolute change applied to all channels (within bounds) |
| [in] | change | The number of colors to change |
Definition at line 150 of file RGBColor.cpp.
References blue(), changedBrightness(), green(), MAX2(), MIN2(), myAlpha, myBlue, myGreen, myRed, and red().
Referenced by alpha(), changedBrightness(), GUIPerson::drawAction_drawAsPoly(), GUIVehicle::drawAction_drawRailCarriages(), GUIBaseVehicle::drawAction_drawVehicleAsPoly(), GNEPoly::drawGL(), and GUIPerson::drawGLAdditional().
|
static |
Converts the given hsv-triplet to rgb.
| [in] | h | Hue (0-360) |
| [in] | s | Saturation (0-1) |
| [in] | v | Value (0-1) |
Definition at line 295 of file RGBColor.cpp.
References RGBColor().
Referenced by alpha(), GLHelper::debugVertices(), GUIEdge::setFunctionalColor(), GUIContainer::setFunctionalColor(), GUIPerson::setFunctionalColor(), GNELane::setFunctionalColor(), GUILane::setFunctionalColor(), and GUIBaseVehicle::setFunctionalColor().
|
inline |
Returns the green-amount of the color.
Definition at line 69 of file RGBColor.h.
References myGreen.
Referenced by changedBrightness(), GUILane::drawAsWaterway(), GLHelper::drawText(), GUIParameterTracker::GUIParameterTrackerPanel::drawValue(), GUIJunctionWrapper::getColorValue(), MFXUtils::getFXColor(), libsumo::Person::getLanePosition(), GUISUMOAbstractView::makeSnapshot(), libsumo::Helper::makeTraCIColor(), GUISUMOAbstractView::onConfigure(), GUISUMOAbstractView::paintGL(), GLHelper::setColor(), and BinaryFormatter::writeAttr().
|
static |
Interpolates between two colors.
The interpolated color is calculated as a weighted average of the RGB values of minColor and maxColor, giving weight to maxColor and 1-weight to minColor.
| [in] | minColor | The color to interpolate from |
| [in] | maxColor | The color to interpolate to |
| [in] | weight | The weight of the first color |
Definition at line 279 of file RGBColor.cpp.
References myAlpha, myBlue, myGreen, myRed, and RGBColor().
Referenced by alpha(), and GUIPropertyScheme< T >::interpolate().
| RGBColor RGBColor::invertedColor | ( | ) | const |
obtain inverted of current RGBColor
Definition at line 139 of file RGBColor.cpp.
References myAlpha, myBlue, myGreen, myRed, and RGBColor().
Referenced by alpha(), and GNEPoly::drawGL().
| bool RGBColor::operator!= | ( | const RGBColor & | c | ) | const |
| bool RGBColor::operator== | ( | const RGBColor & | c | ) | const |
|
static |
Parses a color information.
It is assumed that the color is stored as "<RED>,<GREEN>,<BLUE>" and each color is represented as a double. Alternatively the color can be stored as "<RED>,<GREEN>,<BLUE>,<ALPHA>" and each color is represented as an unsigned byte.
| [in] | coldef | The color definition to parse |
| EmptyData | If the definition has less than three entries |
| NumberFormatException | If one of the components is not numeric |
Definition at line 173 of file RGBColor.cpp.
References TplConvert::_2double(), TplConvert::_2int(), TplConvert::_hex2int(), BLACK, BLUE, CYAN, StringTokenizer::getVector(), GREEN, GREY, MAGENTA, ORANGE, RED, RGBColor(), WHITE, and YELLOW.
Referenced by PCTypeMap::add(), NLHandler::addDistrict(), GNEPolygonFrame::addPOI(), GNEPolygonFrame::addPOILane(), GNEPolygonFrame::addPolygon(), alpha(), SUMOSAXAttributesImpl_Cached::getColor(), SUMOSAXAttributesImpl_Xerces::getColor(), PCLoaderVisum::load(), PCLoaderArcView::load(), PCLoaderDlrNavteq::loadPOIFile(), PCLoaderDlrNavteq::loadPolyFile(), PCLoaderXML::myStartElement(), GNEInspectorFrame::AttributesEditor::AttributeInput::onCmdOpenAttributeDialog(), GNEPolygonFrame::ShapeAttributeSingle::onCmdSetColorAttribute(), GNEAttributeCarrier::parse(), parseColorReporting(), and PCTypeMap::PCTypeMap().
|
static |
Parses a color information.
It is assumed that the color is stored as "<RED>,<GREEN>,<BLUE>" and each color is represented as a double. Alternatively the color can be stored as "<RED>,<GREEN>,<BLUE>,<ALPHA>" and each color is represented as an unsigned byte.
| [in] | coldef | The color definition to parse |
| [in] | objecttype | The type of the currently parsed object |
| [in] | objectid | The id of the currently parsed object |
| [in] | report | Whether errors shall be reported |
| [in,out] | ok | Whether parsing was successful |
| EmptyData | If the definition has less than three entries |
| NumberFormatException | If one of the components is not numeric |
Definition at line 253 of file RGBColor.cpp.
References parseColor(), RGBColor(), UNUSED_PARAMETER, and WRITE_ERROR.
Referenced by alpha(), GUISettingsHandler::myStartElement(), and GUISettingsHandler::parseTextSettings().
|
inline |
Returns the red-amount of the color.
Definition at line 62 of file RGBColor.h.
References myRed.
Referenced by changedBrightness(), GUILane::drawAsWaterway(), GLHelper::drawText(), GUIParameterTracker::GUIParameterTrackerPanel::drawValue(), GUIJunctionWrapper::getColorValue(), MFXUtils::getFXColor(), libsumo::Person::getLanePosition(), GUISUMOAbstractView::makeSnapshot(), libsumo::Helper::makeTraCIColor(), GUISUMOAbstractView::onConfigure(), GUISUMOAbstractView::paintGL(), GLHelper::setColor(), and BinaryFormatter::writeAttr().
| void RGBColor::set | ( | unsigned char | r, |
| unsigned char | g, | ||
| unsigned char | b, | ||
| unsigned char | a | ||
| ) |
assigns new values
| [in] | r | The red component's value |
| [in] | g | The green component's value |
| [in] | b | The blue component's value |
| [in] | a | The alpha component's value |
Definition at line 76 of file RGBColor.cpp.
References myAlpha, myBlue, myGreen, and myRed.
Referenced by libsumo::Vehicle::remove(), and libsumo::Person::setParameter().
|
friend |
Writes the color to the given stream.
| [out] | os | The stream to write to |
| [in] | col | The color to write |
Definition at line 85 of file RGBColor.cpp.
Referenced by alpha().
Definition at line 180 of file RGBColor.h.
Referenced by GNEInternalLane::colorForLinksState(), GUISUMOAbstractView::displayLegend(), GNEViewNet::doPaintGL(), GNEDetectorE1Instant::drawGL(), GNEDetectorE1::drawGL(), GNEDetectorE2::drawGL(), GNERerouter::drawGL(), GUICalibrator::drawGL(), GNECalibrator::drawGL(), GUITriggeredRerouter::GUITriggeredRerouterEdge::drawGL(), GUIParameterTracker::GUIParameterTrackerPanel::drawValue(), GLHelper::getDottedcontourColors(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), GUIParam_PopupMenuInterface::onCmdOpenTracker(), parseColor(), and GUISUMOAbstractView::showToolTipFor().
Definition at line 174 of file RGBColor.h.
Referenced by AGActivityTripWriter::AGActivityTripWriter(), GUIViewTraffic::buildColorRainbow(), GNEViewNet::buildColorRainbow(), GNEViewNet::doPaintGL(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), parseColor(), RODFDetectorCon::saveAsPOIs(), GUIBaseVehicle::setFunctionalColor(), and NBSign::writeAsPOI().
Definition at line 176 of file RGBColor.h.
Referenced by GUIViewTraffic::buildColorRainbow(), GNEViewNet::buildColorRainbow(), GNEConnectorFrame::GNEConnectorFrame(), GNEProhibitionFrame::GNEProhibitionFrame(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), and parseColor().
|
static |
The default color (for vehicle types and vehicles)
Definition at line 185 of file RGBColor.h.
Referenced by MSRoute::getColor(), SUMOVehicleParserHelper::parseCommonAttributes(), MSBaseVehicle::replaceRouteEdges(), MSTriggeredRerouter::rerouteParkingArea(), and GUIBaseVehicle::setFunctionalColor().
|
static |
The string description of the default color.
Definition at line 188 of file RGBColor.h.
Definition at line 173 of file RGBColor.h.
Referenced by AGActivityTripWriter::AGActivityTripWriter(), GUIViewTraffic::buildColorRainbow(), GNEViewNet::buildColorRainbow(), GNECrossingFrame::crossingParameters::crossingParameters(), GNEViewNet::doPaintGL(), GNEVaporizer::drawGL(), GUIBaseVehicle::drawLinkItem(), GNEConnectorFrame::GNEConnectorFrame(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), GUIApplicationWindow::onCmdGaming(), parseColor(), and RODFDetectorCon::saveAsPOIs().
Definition at line 181 of file RGBColor.h.
Referenced by GUIBaseVehicle::drawAction_drawVehicleAsPoly(), GNEDetectorE3::drawGL(), GNEProhibitionFrame::GNEProhibitionFrame(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), parseColor(), and NBSign::writeAsPOI().
Definition at line 177 of file RGBColor.h.
Referenced by GUIViewTraffic::buildColorRainbow(), GNEViewNet::buildColorRainbow(), GNEViewNet::doPaintGL(), GNEConnectorFrame::GNEConnectorFrame(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), and parseColor().
|
private |
Definition at line 192 of file RGBColor.h.
Referenced by alpha(), changedBrightness(), interpolate(), invertedColor(), operator!=(), operator<<(), operator==(), and set().
|
private |
Definition at line 192 of file RGBColor.h.
Referenced by blue(), changedBrightness(), interpolate(), invertedColor(), operator!=(), operator<<(), operator==(), and set().
|
private |
Definition at line 192 of file RGBColor.h.
Referenced by changedBrightness(), green(), interpolate(), invertedColor(), operator!=(), operator<<(), operator==(), and set().
|
private |
The color amounts.
Definition at line 192 of file RGBColor.h.
Referenced by changedBrightness(), interpolate(), invertedColor(), operator!=(), operator<<(), operator==(), red(), and set().
Definition at line 178 of file RGBColor.h.
Referenced by GUIViewTraffic::buildColorRainbow(), GNEViewNet::buildColorRainbow(), GNEPOI::drawGL(), GNEProhibitionFrame::GNEProhibitionFrame(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), and parseColor().
named colors
Definition at line 172 of file RGBColor.h.
Referenced by AGActivityTripWriter::AGActivityTripWriter(), GUIViewTraffic::buildColorRainbow(), GNEViewNet::buildColorRainbow(), GNEViewNet::doPaintGL(), GNERerouter::drawGL(), GNEProhibitionFrame::GNEProhibitionFrame(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), GUIApplicationWindow::onCmdGaming(), parseColor(), RODFDetectorCon::saveAsPOIs(), GUIBaseVehicle::setFunctionalColor(), and NBSign::writeAsPOI().
Definition at line 179 of file RGBColor.h.
Referenced by GNEViewNet::doPaintGL(), GNEDetectorE1Instant::drawGL(), GNEDetectorE1::drawGL(), GNEVaporizer::drawGL(), GNERouteProbe::drawGL(), GNEVariableSpeedSign::drawGL(), GNELane::drawGL(), GNEEdge::drawGL(), GUITLLogicPhasesTrackerWindow::drawValues(), GLHelper::getDottedcontourColors(), GNEProhibitionFrame::GNEProhibitionFrame(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), parseColor(), and GUIBaseVehicle::setFunctionalColor().
Definition at line 175 of file RGBColor.h.
Referenced by SUMOVehicleParserHelper::beginVTypeParsing(), GUIViewTraffic::buildColorRainbow(), GNEViewNet::buildColorRainbow(), GNERouteProbe::drawGL(), GNEConnectorFrame::GNEConnectorFrame(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), NIImporter_Vissim::NIImporter_Vissim(), parseColor(), and NBSign::writeAsPOI().