Skip to content

Commit

Permalink
added lane coloring by angle refs #36 (to figure out directions witho…
Browse files Browse the repository at this point in the history
…ut connection arrows)

git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk/sumo@16315 afbd958f-9f77-42d5-a016-97a22340ccf4
  • Loading branch information
namdre committed May 8, 2014
1 parent 46bf1a9 commit 4e3a369
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
30 changes: 24 additions & 6 deletions src/guisim/GUILane.cpp
Expand Up @@ -715,12 +715,6 @@ GUILane::getEdgeLaneNumber() const {
}


void
GUILane::setColor(const GUIVisualizationSettings& s) const {
GLHelper::setColor(s.laneColorer.getScheme().getColor(getColorValue(s.laneColorer.getActive())));
}


SUMOReal
GUILane::getStoredEdgeTravelTime() const {
MSEdgeWeightsStorage& ews = MSNet::getInstance()->getWeightsStorage();
Expand All @@ -733,6 +727,30 @@ GUILane::getStoredEdgeTravelTime() const {
}
}


void
GUILane::setColor(const GUIVisualizationSettings& s) const {
const GUIColorer& c = s.laneColorer;
if (!setFunctionalColor(c.getActive())) {
GLHelper::setColor(c.getScheme().getColor(getColorValue(c.getActive())));
}
}


bool
GUILane::setFunctionalColor(size_t activeScheme) const {
switch (activeScheme) {
case 18: {
SUMOReal hue = RAD2DEG(myShape.beginEndAngle()) + 180; // [0-360]
GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.));
return true;
}
default:
return false;
}
}


SUMOReal
GUILane::getColorValue(size_t activeScheme) const {
switch (activeScheme) {
Expand Down
3 changes: 3 additions & 0 deletions src/guisim/GUILane.h
Expand Up @@ -253,6 +253,9 @@ class GUILane : public MSLane, public GUIGlObject {
/// @brief gets the color value according to the current scheme index
SUMOReal getColorValue(size_t activeScheme) const;

/// @brief sets the color according to the current scheme index and some lane function
bool setFunctionalColor(size_t activeScheme) const;

/// @brief sets the color according to the currente settings
void setColor(const GUIVisualizationSettings& s) const;

Expand Down
1 change: 1 addition & 0 deletions src/utils/gui/settings/GUIVisualizationSettings.cpp
Expand Up @@ -150,6 +150,7 @@ GUIVisualizationSettings::GUIVisualizationSettings()
scheme.addColor(RGBColor::GREEN, (SUMOReal)2.0);
scheme.addColor(RGBColor::BLUE, (SUMOReal)4.0);
laneColorer.addScheme(scheme);
laneColorer.addScheme(GUIColorScheme("by angle", RGBColor::YELLOW, "", true));


/// add vehicle coloring schemes
Expand Down

0 comments on commit 4e3a369

Please sign in to comment.