Skip to content

Commit 68419cf

Browse files
committed
fix #16080
1 parent 13cbdac commit 68419cf

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

src/utils/gui/settings/GUISettingsHandler.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,8 @@ GUISettingsHandler::parseRainbowSettings(
503503
StringUtils::toDouble(attrs.getStringSecure(prefix + "HideThreshold2", toString(defaults.maxThreshold))),
504504
StringUtils::toBool(attrs.getStringSecure(prefix + "SetNeutral", toString(defaults.hideMax))),
505505
StringUtils::toDouble(attrs.getStringSecure(prefix + "NeutralThreshold", toString(defaults.neutralThreshold))),
506-
StringUtils::toBool(attrs.getStringSecure(prefix + "FixRange", toString(defaults.fixRange))));
506+
StringUtils::toBool(attrs.getStringSecure(prefix + "FixRange", toString(defaults.fixRange))),
507+
StringUtils::toInt(attrs.getStringSecure(prefix + "RainbowScheme", toString(defaults.rainbowScheme))));
507508
}
508509

509510
const std::vector<std::string>&

src/utils/gui/settings/GUIVisualizationSettings.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,16 @@ GUIVisualizationTextSettings::show(const GUIGlObject* o) const {
286286
// GUIVisualizationRainbowSettings - methods
287287
// ---------------------------------------------------------------------------
288288

289-
GUIVisualizationRainbowSettings::GUIVisualizationRainbowSettings(bool _hideMin, double _minThreshold, bool _hideMax, double _maxThreshold, bool _setNeutral, double _neutralThreshold, bool _fixRange) :
289+
GUIVisualizationRainbowSettings::GUIVisualizationRainbowSettings(bool _hideMin, double _minThreshold, bool _hideMax, double _maxThreshold, bool _setNeutral,
290+
double _neutralThreshold, bool _fixRange, int _rainbowScheme) :
290291
hideMin(_hideMin),
291292
minThreshold(_minThreshold),
292293
hideMax(_hideMax),
293294
maxThreshold(_maxThreshold),
294295
setNeutral(_setNeutral),
295296
neutralThreshold(_neutralThreshold),
296297
fixRange(_fixRange),
298+
rainbowScheme(_rainbowScheme),
297299
colors(GUIVisualizationSettings::RAINBOW_SCHEMES["classic"])
298300
{ }
299301

@@ -306,7 +308,8 @@ GUIVisualizationRainbowSettings::operator==(const GUIVisualizationRainbowSetting
306308
(maxThreshold == other.maxThreshold) &&
307309
(setNeutral == other.setNeutral) &&
308310
(neutralThreshold == other.neutralThreshold) &&
309-
(fixRange == other.fixRange);
311+
(fixRange == other.fixRange) &&
312+
(rainbowScheme == other.rainbowScheme);
310313
}
311314

312315

@@ -325,6 +328,7 @@ GUIVisualizationRainbowSettings::print(OutputDevice& dev, const std::string& nam
325328
dev.writeAttr(name + "SetNeutral", setNeutral);
326329
dev.writeAttr(name + "NeutralThreshold", neutralThreshold);
327330
dev.writeAttr(name + "FixRange", fixRange);
331+
dev.writeAttr(name + "RainbowScheme", rainbowScheme);
328332
}
329333

330334

@@ -586,7 +590,7 @@ GUIVisualizationSettings::GUIVisualizationSettings(const std::string& _name, boo
586590
edgeData("speed"),
587591
edgeDataID(""),
588592
edgeDataScaling(""),
589-
edgeValueRainBow(false, 0, false, 200, false, 0, false),
593+
edgeValueRainBow(false, 0, false, 200, false, 0, false, 1),
590594
vehicleQuality(0), showBlinker(true),
591595
drawLaneChangePreference(false),
592596
drawMinGap(false),
@@ -622,7 +626,7 @@ GUIVisualizationSettings::GUIVisualizationSettings(const std::string& _name, boo
622626
drawJunctionShape(true),
623627
drawCrossingsAndWalkingareas(true),
624628
junctionSize(1),
625-
junctionValueRainBow(false, 0, false, 100, false, 0, false),
629+
junctionValueRainBow(false, 0, false, 100, false, 0, false, 1),
626630
addMode(0),
627631
addSize(1),
628632
addName(false, 60, RGBColor(255, 0, 128, 255)),
@@ -643,7 +647,7 @@ GUIVisualizationSettings::GUIVisualizationSettings(const std::string& _name, boo
643647
tazRelWidthExaggeration(1),
644648
edgeRelWidthExaggeration(1),
645649
relDataAttr("count"),
646-
dataValueRainBow(false, -100, false, 100, false, 0, false),
650+
dataValueRainBow(false, -100, false, 100, false, 0, false, 1),
647651
show3DTLSLinkMarkers(true),
648652
show3DTLSDomes(true),
649653
generate3DTLSModels(false),

src/utils/gui/settings/GUIVisualizationSettings.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ struct GUIVisualizationTextSettings {
8989
struct GUIVisualizationRainbowSettings {
9090

9191
/// @brief constructor
92-
GUIVisualizationRainbowSettings(bool _hideMin, double _minThreshold, bool _hideMax, double _maxThreshold, bool _setNeutral, double _neutralThreshold, bool _fixRange);
92+
GUIVisualizationRainbowSettings(bool _hideMin, double _minThreshold, bool _hideMax, double _maxThreshold, bool _setNeutral,
93+
double _neutralThreshold, bool _fixRange, int _rainboScheme);
9394

9495
/// @brief equality comparator
9596
bool operator==(const GUIVisualizationRainbowSettings& other);
@@ -114,6 +115,8 @@ struct GUIVisualizationRainbowSettings {
114115
double neutralThreshold;
115116
/// @brief whether the color scale should be fixed to the given min/max values
116117
bool fixRange;
118+
/// @brief index in the list of color schemes
119+
int rainbowScheme;
117120
/// @brief color steps for the rainbow;
118121
std::vector<RGBColor> colors;
119122
};

src/utils/gui/windows/GUIDialog_ViewSettings.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -1691,10 +1691,11 @@ GUIDialog_ViewSettings::RainbowPanel::RainbowPanel(
16911691
FXMatrix* matrixRainbow = new FXMatrix(parent, 9, GUIDesignViewSettingsMatrix3);
16921692
myColorRainbow = GUIDesigns::buildFXButton(matrixRainbow, TL("Recalibrate Rainbow"), "", "", nullptr, target, MID_SIMPLE_VIEW_COLORCHANGE,
16931693
(BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT), 0, 0, 0, 0, 20, 20, 4, 4);
1694-
myRainbowStyle = new MFXComboBoxIcon(matrixRainbow, 5, false, 10, target, MID_SIMPLE_VIEW_RAINBOW_CHANGE, GUIDesignViewSettingsComboBox1);
1694+
myRainbowStyle = new MFXComboBoxIcon(matrixRainbow, 5, false, 10, target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsComboBox1);
16951695
for (auto item : GUIVisualizationSettings::RAINBOW_SCHEMES) {
16961696
myRainbowStyle->appendIconItem(item.first.c_str());
16971697
}
1698+
myRainbowStyle->setCurrentItem(settings.rainbowScheme);
16981699
myHideMinCheck = new FXCheckButton(matrixRainbow, TL("min"), target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButtonViewSettings);
16991700
myHideMinCheck->setCheck(settings.hideMin);
17001701
myMinThreshold = new FXRealSpinner(matrixRainbow, 6, target, MID_SIMPLE_VIEW_COLORCHANGE, REALSPIN_NOMIN | GUIDesignViewSettingsSpinDial2);
@@ -1723,7 +1724,8 @@ GUIDialog_ViewSettings::RainbowPanel::getSettings() {
17231724
myMaxThreshold->getValue(),
17241725
mySetNeutral->getCheck() != FALSE,
17251726
myNeutralThreshold->getValue(),
1726-
myFixRange->getCheck() != FALSE);
1727+
myFixRange->getCheck() != FALSE,
1728+
myRainbowStyle->getCurrentItem());
17271729
std::string sName = myRainbowStyle->getItemText(myRainbowStyle->getCurrentItem());
17281730
res.colors = GUIVisualizationSettings::RAINBOW_SCHEMES[sName];
17291731
return res;
@@ -1739,6 +1741,7 @@ GUIDialog_ViewSettings::RainbowPanel::update(const GUIVisualizationRainbowSettin
17391741
mySetNeutral->setCheck(settings.setNeutral);
17401742
myNeutralThreshold->setValue(settings.neutralThreshold);
17411743
myFixRange->setCheck(settings.fixRange);
1744+
myRainbowStyle->setCurrentItem(settings.rainbowScheme);
17421745
}
17431746

17441747
void

0 commit comments

Comments
 (0)