LCOV - code coverage report
Current view: top level - src/utils/gui/settings - GUISettingsHandler.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 81.5 % 439 358
Test Date: 2026-10-12 15:53:19 Functions: 76.5 % 17 13

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    GUISettingsHandler.cpp
      15              : /// @author  Michael Behrisch
      16              : /// @author  Daniel Krajzewicz
      17              : /// @author  Jakob Erdmann
      18              : /// @author  Laura Bieker
      19              : /// @author  Mirko Barthauer
      20              : /// @date    Fri, 24. Apr 2009
      21              : ///
      22              : // The dialog to change the view (gui) settings.
      23              : /****************************************************************************/
      24              : #include <config.h>
      25              : 
      26              : #include <vector>
      27              : #include <utils/common/StringUtils.h>
      28              : #include <utils/common/ToString.h>
      29              : #include <utils/common/RGBColor.h>
      30              : #include <utils/common/MsgHandler.h>
      31              : #include <utils/common/FileHelpers.h>
      32              : #include <utils/gui/settings/GUIVisualizationSettings.h>
      33              : #include <utils/gui/settings/GUICompleteSchemeStorage.h>
      34              : #include <utils/gui/windows/GUIPerspectiveChanger.h>
      35              : #include <utils/foxtools/MFXImageHelper.h>
      36              : #include <utils/geom/GeoConvHelper.h>
      37              : #include <utils/xml/SUMOSAXReader.h>
      38              : #include <utils/xml/XMLSubSys.h>
      39              : #include "GUISettingsHandler.h"
      40              : 
      41              : 
      42              : // ===========================================================================
      43              : // method definitions
      44              : // ===========================================================================
      45           37 : GUISettingsHandler::GUISettingsHandler(FXApp* app, const std::string& content, bool isFile, bool netedit) :
      46              :     SUMOSAXHandler(content),
      47           37 :     myApp(app),
      48           74 :     mySettings(nullptr, "TEMPORARY_NAME", netedit),
      49           37 :     myDelay(-1), myLookFrom(-1, -1, -1), myLookAt(-1, -1, -1), myZCoordSet(true),
      50           37 :     myRotation(0),
      51           37 :     myZoom(-1),
      52           37 :     myCurrentColorer(SUMO_TAG_NOTHING),
      53           37 :     myCurrentScheme(nullptr),
      54           74 :     myJamSoundTime(-1) {
      55           37 :     if (isFile) {
      56           37 :         XMLSubSys::runParser(*this, content);
      57              :     } else {
      58            0 :         setFileName("registrySettings");
      59            0 :         SUMOSAXReader* reader = XMLSubSys::getSAXReader(*this);
      60            0 :         reader->parseString(content);
      61            0 :         delete reader;
      62              :     }
      63           37 : }
      64              : 
      65              : 
      66           37 : GUISettingsHandler::~GUISettingsHandler() {
      67          111 : }
      68              : 
      69              : 
      70              : void
      71        18748 : GUISettingsHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) {
      72        18748 :     bool ok = true;
      73        18748 :     switch (element) {
      74            0 :         case SUMO_TAG_BREAKPOINT:
      75            0 :             if (attrs.hasAttribute(SUMO_ATTR_TIME)) {
      76            0 :                 myBreakpoints.push_back(attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, nullptr, ok));
      77              :             } else {
      78            0 :                 myBreakpoints.push_back(attrs.getSUMOTimeReporting(SUMO_ATTR_VALUE, nullptr, ok));
      79            0 :                 WRITE_WARNING(TL("The 'value' attribute is deprecated for breakpoints. Please use 'time'."));
      80              :             }
      81              :             break;
      82              :         case SUMO_TAG_VIEWSETTINGS:
      83           34 :             myViewType = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, nullptr, ok, "default");
      84           34 :             myViewType = StringUtils::to_lower_case(myViewType);
      85           34 :             break;
      86            2 :         case SUMO_TAG_VIEWSETTINGS_3D:
      87            4 :             mySettings.show3DTLSLinkMarkers = StringUtils::toBool(attrs.getStringSecure("show3DTLSLinkMarkers", toString(mySettings.show3DTLSLinkMarkers)));
      88            4 :             mySettings.show3DTLSDomes = StringUtils::toBool(attrs.getStringSecure("show3DTLSDomes", toString(mySettings.show3DTLSDomes)));
      89            4 :             mySettings.show3DHeadUpDisplay = StringUtils::toBool(attrs.getStringSecure("show3DHeadUpDisplay", toString(mySettings.show3DHeadUpDisplay)));
      90            4 :             mySettings.generate3DTLSModels = StringUtils::toBool(attrs.getStringSecure("generate3DTLSModels", toString(mySettings.generate3DTLSModels)));
      91            2 :             mySettings.ambient3DLight = parseColor(attrs, "ambient3DLight", mySettings.ambient3DLight);
      92            2 :             mySettings.diffuse3DLight = parseColor(attrs, "diffuse3DLight", mySettings.diffuse3DLight);
      93            2 :             break;
      94            5 :         case SUMO_TAG_DELAY:
      95            5 :             myDelay = attrs.getOpt<double>(SUMO_ATTR_VALUE, nullptr, ok, myDelay);
      96            5 :             break;
      97            6 :         case SUMO_TAG_VIEWPORT: {
      98            6 :             double x = attrs.getOpt<double>(SUMO_ATTR_X, nullptr, ok, myLookFrom.x());
      99            6 :             double y = attrs.getOpt<double>(SUMO_ATTR_Y, nullptr, ok, myLookFrom.y());
     100            6 :             if (attrs.hasAttribute(SUMO_ATTR_LAT) && attrs.hasAttribute(SUMO_ATTR_LON)) {
     101            0 :                 Position geo(attrs.get<double>(SUMO_ATTR_LON, nullptr, ok), attrs.get<double>(SUMO_ATTR_LAT, nullptr, ok));
     102            0 :                 if (GeoConvHelper::getFinal().x2cartesian_const(geo)) {
     103              :                     x = geo.x();
     104              :                     y = geo.y();
     105              :                 }
     106              :             }
     107            6 :             const double z = attrs.getOpt<double>(SUMO_ATTR_Z, nullptr, ok, myLookFrom.z());
     108            6 :             attrs.get<double>(SUMO_ATTR_Z, nullptr, myZCoordSet, false);
     109              :             myLookFrom.set(x, y, z);
     110            6 :             myZoom = attrs.getOpt<double>(SUMO_ATTR_ZOOM, nullptr, ok, myZoom);
     111            6 :             const double cx = attrs.getOpt<double>(SUMO_ATTR_CENTER_X, nullptr, ok, myLookFrom.x());
     112            6 :             const double cy = attrs.getOpt<double>(SUMO_ATTR_CENTER_Y, nullptr, ok, myLookFrom.y());
     113            6 :             const double cz = attrs.getOpt<double>(SUMO_ATTR_CENTER_Z, nullptr, ok, 0.);
     114              :             myLookAt.set(cx, cy, cz);
     115            6 :             myRotation = attrs.getOpt<double>(SUMO_ATTR_ANGLE, nullptr, ok, myRotation);
     116            6 :             break;
     117              :         }
     118            2 :         case SUMO_TAG_SNAPSHOT: {
     119            2 :             std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, nullptr, ok);
     120            2 :             if (file != "" && !FileHelpers::isAbsolute(file)) {
     121            4 :                 file = FileHelpers::getConfigurationRelative(getFileName(), file);
     122              :             }
     123            2 :             mySnapshots[attrs.getOptSUMOTimeReporting(SUMO_ATTR_TIME, file.c_str(), ok, 0)].push_back(file);
     124              :         }
     125            2 :         break;
     126           34 :         case SUMO_TAG_VIEWSETTINGS_SCHEME: {
     127           34 :             mySettings.name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, nullptr, ok, mySettings.name);
     128           34 :             if (gSchemeStorage.contains(mySettings.name)) {
     129            0 :                 mySettings.copy(gSchemeStorage.get(mySettings.name));
     130              :             }
     131              :         }
     132              :         break;
     133           34 :         case SUMO_TAG_VIEWSETTINGS_OPENGL:
     134           68 :             mySettings.dither = StringUtils::toBool(attrs.getStringSecure("dither", toString(mySettings.dither)));
     135           68 :             mySettings.fps = StringUtils::toBool(attrs.getStringSecure("fps", toString(mySettings.fps)));
     136           68 :             mySettings.trueZ = StringUtils::toBool(attrs.getStringSecure("trueZ", toString(mySettings.trueZ)));
     137           68 :             mySettings.drawBoundaries = StringUtils::toBool(attrs.getStringSecure("drawBoundaries", toString(mySettings.drawBoundaries)));
     138           68 :             mySettings.forceDrawForRectangleSelection = StringUtils::toBool(attrs.getStringSecure("forceDrawRectangleSelection", toString(mySettings.forceDrawForRectangleSelection)));
     139           68 :             mySettings.disableDottedContours = StringUtils::toBool(attrs.getStringSecure("disableDottedContours", toString(mySettings.disableDottedContours)));
     140           34 :             mySettings.geometryIndices = parseTextSettings("geometryIndices", attrs, mySettings.geometryIndices);
     141           34 :             break;
     142              :         case SUMO_TAG_VIEWSETTINGS_BACKGROUND:
     143           68 :             mySettings.backgroundColor = RGBColor::parseColorReporting(attrs.getStringSecure("backgroundColor", toString(mySettings.backgroundColor)), "background", nullptr, true, ok);
     144           68 :             mySettings.showGrid = StringUtils::toBool(attrs.getStringSecure("showGrid", toString(mySettings.showGrid)));
     145           68 :             mySettings.gridXSize = StringUtils::toDouble(attrs.getStringSecure("gridXSize", toString(mySettings.gridXSize)));
     146           68 :             mySettings.gridYSize = StringUtils::toDouble(attrs.getStringSecure("gridYSize", toString(mySettings.gridYSize)));
     147           34 :             break;
     148           34 :         case SUMO_TAG_VIEWSETTINGS_EDGES: {
     149           68 :             int laneEdgeMode = StringUtils::toInt(attrs.getStringSecure("laneEdgeMode", "0"));
     150           68 :             int laneEdgeScaleMode = StringUtils::toInt(attrs.getStringSecure("scaleMode", "0"));
     151           68 :             mySettings.laneShowBorders = StringUtils::toBool(attrs.getStringSecure("laneShowBorders", toString(mySettings.laneShowBorders)));
     152           68 :             mySettings.showBikeMarkings = StringUtils::toBool(attrs.getStringSecure("showBikeMarkings", toString(mySettings.showBikeMarkings)));
     153           68 :             mySettings.showLinkDecals = StringUtils::toBool(attrs.getStringSecure("showLinkDecals", toString(mySettings.showLinkDecals)));
     154           68 :             mySettings.realisticLinkRules = StringUtils::toBool(attrs.getStringSecure("realisticLinkRules", toString(mySettings.realisticLinkRules)));
     155           68 :             mySettings.showLinkRules = StringUtils::toBool(attrs.getStringSecure("showLinkRules", toString(mySettings.showLinkRules)));
     156           68 :             mySettings.showRails = StringUtils::toBool(attrs.getStringSecure("showRails", toString(mySettings.showRails)));
     157           68 :             mySettings.secondaryShape = StringUtils::toBool(attrs.getStringSecure("secondaryShape", toString(mySettings.secondaryShape)));
     158           34 :             mySettings.edgeName = parseTextSettings("edgeName", attrs, mySettings.edgeName);
     159           34 :             mySettings.internalEdgeName = parseTextSettings("internalEdgeName", attrs, mySettings.internalEdgeName);
     160           34 :             mySettings.cwaEdgeName = parseTextSettings("cwaEdgeName", attrs, mySettings.cwaEdgeName);
     161           34 :             mySettings.streetName = parseTextSettings("streetName", attrs, mySettings.streetName);
     162           34 :             mySettings.edgeValue = parseTextSettings("edgeValue", attrs, mySettings.edgeValue);
     163           34 :             mySettings.edgeScaleValue = parseTextSettings("edgeScaleValue", attrs, mySettings.edgeScaleValue);
     164           68 :             mySettings.hideConnectors = StringUtils::toBool(attrs.getStringSecure("hideConnectors", toString(mySettings.hideConnectors)));
     165           68 :             mySettings.laneWidthExaggeration = StringUtils::toDouble(attrs.getStringSecure("widthExaggeration", toString(mySettings.laneWidthExaggeration)));
     166           68 :             mySettings.laneMinSize = StringUtils::toDouble(attrs.getStringSecure("minSize", toString(mySettings.laneMinSize)));
     167           68 :             mySettings.showLaneDirection = StringUtils::toBool(attrs.getStringSecure("showDirection", toString(mySettings.showLaneDirection)));
     168           68 :             mySettings.showSublanes = StringUtils::toBool(attrs.getStringSecure("showSublanes", toString(mySettings.showSublanes)));
     169           68 :             mySettings.spreadSuperposed = StringUtils::toBool(attrs.getStringSecure("spreadSuperposed", toString(mySettings.spreadSuperposed)));
     170           68 :             mySettings.disableHideByZoom = StringUtils::toBool(attrs.getStringSecure("disableHideByZoom", toString(mySettings.disableHideByZoom)));
     171              : 
     172              :             // disable hide by zoom is the only
     173           34 :             if (myApp) {
     174           34 :                 myApp->reg().writeBoolEntry("NETEDIT", "disableHideByZoom", mySettings.disableHideByZoom);
     175              :             }
     176              : 
     177           34 :             mySettings.edgeParam = attrs.getStringSecure("edgeParam", mySettings.edgeParam);
     178           34 :             mySettings.laneParam = attrs.getStringSecure("laneParam", mySettings.laneParam);
     179           34 :             mySettings.edgeData = attrs.getStringSecure("edgeData", mySettings.edgeData);
     180           34 :             mySettings.edgeDataID = attrs.getStringSecure("edgeDataID", mySettings.edgeDataID);
     181           34 :             mySettings.edgeDataScaling = attrs.getStringSecure("edgeDataScaling", mySettings.edgeDataScaling);
     182           68 :             mySettings.edgeValueRainBow = parseRainbowSettings("edgeValue", attrs, mySettings.edgeValueRainBow);
     183           34 :             myCurrentColorer = element;
     184              :             mySettings.edgeColorer.setActive(laneEdgeMode);
     185              :             mySettings.edgeScaler.setActive(laneEdgeScaleMode);
     186              :             mySettings.laneColorer.setActive(laneEdgeMode);
     187              :             mySettings.laneScaler.setActive(laneEdgeScaleMode);
     188              :         }
     189              :         break;
     190         3294 :         case SUMO_TAG_COLORSCHEME: {
     191         3294 :             myCurrentScheme = nullptr;
     192         3294 :             myCurrentScaleScheme = nullptr;
     193         3294 :             const std::string name = attrs.getStringSecure(SUMO_ATTR_NAME, "");
     194         3294 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_EDGES) {
     195         3060 :                 if (StringUtils::startsWith(name, "meso:")) {
     196              :                     // see edgeColorer.save() in GUIVisualizationSettings::save
     197          880 :                     myCurrentScheme = mySettings.edgeColorer.getSchemeByName(name.substr(5));
     198              :                 } else {
     199         1090 :                     myCurrentScheme = mySettings.laneColorer.getSchemeByName(name);
     200              :                 }
     201         1530 :                 if (myCurrentScheme == nullptr) {
     202              :                     // legacy: meso schemes without prefix
     203           68 :                     myCurrentScheme = mySettings.edgeColorer.getSchemeByName(name);
     204              :                 }
     205              :             }
     206         3294 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_VEHICLES) {
     207          968 :                 myCurrentScheme = mySettings.vehicleColorer.getSchemeByName(name);
     208              :             }
     209         3294 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_PERSONS) {
     210          282 :                 myCurrentScheme = mySettings.personColorer.getSchemeByName(name);
     211              :             }
     212         3294 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_JUNCTIONS) {
     213          110 :                 myCurrentScheme = mySettings.junctionColorer.getSchemeByName(name);
     214              :             }
     215         3294 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_POIS) {
     216           72 :                 myCurrentScheme = mySettings.poiColorer.getSchemeByName(name);
     217              :             }
     218         3294 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_POLYS) {
     219           74 :                 myCurrentScheme = mySettings.polyColorer.getSchemeByName(name);
     220              :             }
     221         3294 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_DATA) {
     222            0 :                 myCurrentScheme = mySettings.dataColorer.getSchemeByName(name);
     223              :             }
     224         3294 :             if (myCurrentScheme && !myCurrentScheme->isFixed()) {
     225         1914 :                 myCurrentScheme->setInterpolated(attrs.getOpt<bool>(SUMO_ATTR_INTERPOLATED, nullptr, ok, false));
     226         1914 :                 myCurrentScheme->clear();
     227              :             }
     228              :         }
     229         3294 :         break;
     230          819 :         case SUMO_TAG_SCALINGSCHEME: {
     231          819 :             myCurrentScheme = nullptr;
     232          819 :             myCurrentScaleScheme = nullptr;
     233          819 :             const std::string name = attrs.getStringSecure(SUMO_ATTR_NAME, "");
     234          819 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_EDGES) {
     235         1578 :                 if (StringUtils::startsWith(name, "meso:")) {
     236              :                     // see edgeScaler.save() in GUIVisualizationSettings::save
     237            0 :                     myCurrentScaleScheme = mySettings.edgeScaler.getSchemeByName(name.substr(5));
     238              :                 } else {
     239          789 :                     myCurrentScaleScheme = mySettings.laneScaler.getSchemeByName(name);
     240              :                 }
     241          789 :                 if (myCurrentScaleScheme == nullptr) {
     242              :                     // legacy: meso schemes without prefix
     243          146 :                     myCurrentScaleScheme = mySettings.edgeScaler.getSchemeByName(name);
     244              :                 }
     245              :             }
     246          819 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_VEHICLES) {
     247           30 :                 myCurrentScaleScheme = mySettings.vehicleScaler.getSchemeByName(name);
     248              :             }
     249          819 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_DATA) {
     250            0 :                 myCurrentScaleScheme = mySettings.dataScaler.getSchemeByName(name);
     251              :             }
     252          819 :             if (myCurrentScaleScheme && !myCurrentScaleScheme->isFixed()) {
     253          715 :                 myCurrentScaleScheme->setInterpolated(attrs.getOpt<bool>(SUMO_ATTR_INTERPOLATED, nullptr, ok, false));
     254          715 :                 myCurrentScaleScheme->clear();
     255              :             }
     256              :         }
     257          819 :         break;
     258        14019 :         case SUMO_TAG_ENTRY:
     259        14019 :             if (myCurrentScheme != nullptr) {
     260        11398 :                 RGBColor color = attrs.get<RGBColor>(SUMO_ATTR_COLOR, nullptr, ok);
     261        11398 :                 if (myCurrentScheme->isFixed()) {
     262         4272 :                     myCurrentScheme->setColor(attrs.getStringSecure(SUMO_ATTR_NAME, ""), color);
     263              :                 } else {
     264         9262 :                     myCurrentScheme->addColor(color,
     265              :                                               attrs.getOpt<double>(SUMO_ATTR_THRESHOLD, nullptr, ok, std::numeric_limits<double>::max()),
     266        18524 :                                               attrs.getStringSecure(SUMO_ATTR_NAME, ""));
     267              :                 }
     268         2621 :             } else if (myCurrentScaleScheme != nullptr) {
     269         1865 :                 double scale = attrs.get<double>(SUMO_ATTR_COLOR, nullptr, ok);
     270         1865 :                 if (myCurrentScaleScheme->isFixed()) {
     271          304 :                     myCurrentScaleScheme->setColor(attrs.getStringSecure(SUMO_ATTR_NAME, ""), scale);
     272              :                 } else {
     273         1713 :                     myCurrentScaleScheme->addColor(scale,
     274              :                                                    attrs.getOpt<double>(SUMO_ATTR_THRESHOLD, nullptr, ok, std::numeric_limits<double>::max()),
     275         3426 :                                                    attrs.getStringSecure(SUMO_ATTR_NAME, ""));
     276              :                 }
     277              :             }
     278              :             break;
     279           34 :         case SUMO_TAG_VIEWSETTINGS_VEHICLES:
     280           68 :             mySettings.vehicleColorer.setActive(StringUtils::toInt(attrs.getStringSecure("vehicleMode", "0")));
     281           68 :             mySettings.vehicleScaler.setActive(StringUtils::toInt(attrs.getStringSecure("vehicleScaleMode", "0")));
     282           68 :             mySettings.vehicleQuality = StringUtils::toInt(attrs.getStringSecure("vehicleQuality", toString(mySettings.vehicleQuality)));
     283           68 :             mySettings.showBlinker = StringUtils::toBool(attrs.getStringSecure("showBlinker", toString(mySettings.showBlinker)));
     284           68 :             mySettings.drawMinGap = StringUtils::toBool(attrs.getStringSecure("drawMinGap", toString(mySettings.drawMinGap)));
     285           68 :             mySettings.drawBrakeGap = StringUtils::toBool(attrs.getStringSecure("drawBrakeGap", toString(mySettings.drawBrakeGap)));
     286           68 :             mySettings.showBTRange = StringUtils::toBool(attrs.getStringSecure("showBTRange", toString(mySettings.showBTRange)));
     287           68 :             mySettings.showRouteIndex = StringUtils::toBool(attrs.getStringSecure("showRouteIndex", toString(mySettings.showRouteIndex)));
     288           68 :             mySettings.scaleLength = StringUtils::toBool(attrs.getStringSecure("scaleLength", toString(mySettings.scaleLength)));
     289           68 :             mySettings.drawReversed = StringUtils::toBool(attrs.getStringSecure("drawReversed", toString(mySettings.drawReversed)));
     290           68 :             mySettings.showParkingInfo = StringUtils::toBool(attrs.getStringSecure("showParkingInfo", toString(mySettings.showParkingInfo)));
     291           68 :             mySettings.showChargingInfo = StringUtils::toBool(attrs.getStringSecure("showChargingInfo", toString(mySettings.showChargingInfo)));
     292           34 :             mySettings.vehicleSize = parseSizeSettings("vehicle", attrs, mySettings.vehicleSize);
     293           34 :             mySettings.vehicleName = parseTextSettings("vehicleName", attrs, mySettings.vehicleName);
     294           34 :             mySettings.vehicleValue = parseTextSettings("vehicleValue", attrs, mySettings.vehicleValue);
     295           34 :             mySettings.vehicleScaleValue = parseTextSettings("vehicleScaleValue", attrs, mySettings.vehicleScaleValue);
     296           34 :             mySettings.vehicleText = parseTextSettings("vehicleText", attrs, mySettings.vehicleText);
     297           34 :             mySettings.vehicleParam = attrs.getStringSecure("vehicleParam", mySettings.vehicleParam);
     298           34 :             mySettings.vehicleScaleParam = attrs.getStringSecure("vehicleScaleParam", mySettings.vehicleScaleParam);
     299           34 :             mySettings.vehicleTextParam = attrs.getStringSecure("vehicleTextParam", mySettings.vehicleTextParam);
     300           68 :             mySettings.vehicleValueRainBow = parseRainbowSettings("vehicleValueRainbow", attrs, mySettings.vehicleValueRainBow);
     301           34 :             myCurrentColorer = element;
     302           34 :             break;
     303           26 :         case SUMO_TAG_VIEWSETTINGS_PERSONS:
     304           52 :             mySettings.personColorer.setActive(StringUtils::toInt(attrs.getStringSecure("personMode", "0")));
     305           52 :             mySettings.personQuality = StringUtils::toInt(attrs.getStringSecure("personQuality", toString(mySettings.personQuality)));
     306           26 :             mySettings.personSize = parseSizeSettings("person", attrs, mySettings.personSize);
     307           26 :             mySettings.personName = parseTextSettings("personName", attrs, mySettings.personName);
     308           26 :             mySettings.personValue = parseTextSettings("personValue", attrs, mySettings.personValue);
     309           52 :             mySettings.showPedestrianNetwork = StringUtils::toBool(attrs.getStringSecure("showPedestrianNetwork", toString(mySettings.showPedestrianNetwork)));
     310           52 :             mySettings.pedestrianNetworkColor = RGBColor::parseColorReporting(attrs.getStringSecure("pedestrianNetworkColor", toString(mySettings.pedestrianNetworkColor)), "pedestrianNetworkColor", nullptr, true, ok);
     311           26 :             myCurrentColorer = element;
     312           26 :             break;
     313           26 :         case SUMO_TAG_VIEWSETTINGS_CONTAINERS:
     314           52 :             mySettings.containerColorer.setActive(StringUtils::toInt(attrs.getStringSecure("containerMode", "0")));
     315           52 :             mySettings.containerQuality = StringUtils::toInt(attrs.getStringSecure("containerQuality", toString(mySettings.containerQuality)));
     316           26 :             mySettings.containerSize = parseSizeSettings("container", attrs, mySettings.containerSize);
     317           26 :             mySettings.containerName = parseTextSettings("containerName", attrs, mySettings.containerName);
     318           26 :             myCurrentColorer = element;
     319           26 :             break;
     320           34 :         case SUMO_TAG_VIEWSETTINGS_JUNCTIONS:
     321           68 :             mySettings.junctionColorer.setActive(StringUtils::toInt(attrs.getStringSecure("junctionMode", "0")));
     322           34 :             mySettings.drawLinkTLIndex = parseTextSettings("drawLinkTLIndex", attrs, mySettings.drawLinkTLIndex);
     323           34 :             mySettings.drawLinkJunctionIndex = parseTextSettings("drawLinkJunctionIndex", attrs, mySettings.drawLinkJunctionIndex);
     324           34 :             mySettings.junctionID = parseTextSettings("junctionID", attrs, mySettings.junctionID);
     325           34 :             mySettings.junctionName = parseTextSettings("junctionName", attrs, mySettings.junctionName);
     326           34 :             mySettings.internalJunctionName = parseTextSettings("internalJunctionName", attrs, mySettings.internalJunctionName);
     327           34 :             mySettings.tlsPhaseIndex = parseTextSettings("tlsPhaseIndex", attrs, mySettings.tlsPhaseIndex);
     328           34 :             mySettings.tlsPhaseName = parseTextSettings("tlsPhaseName", attrs, mySettings.tlsPhaseName);
     329           68 :             mySettings.showLane2Lane = StringUtils::toBool(attrs.getStringSecure("showLane2Lane", toString(mySettings.showLane2Lane)));
     330           68 :             mySettings.drawJunctionShape = StringUtils::toBool(attrs.getStringSecure("drawShape", toString(mySettings.drawJunctionShape)));
     331           68 :             mySettings.drawCrossingsAndWalkingareas = StringUtils::toBool(attrs.getStringSecure(
     332           34 :                         "drawCrossingsAndWalkingareas", toString(mySettings.drawCrossingsAndWalkingareas)));
     333           34 :             mySettings.junctionSize = parseSizeSettings("junction", attrs, mySettings.junctionSize);
     334           68 :             mySettings.junctionValueRainBow = parseRainbowSettings("junctionValue", attrs, mySettings.junctionValueRainBow);
     335           34 :             myCurrentColorer = element;
     336           34 :             break;
     337           34 :         case SUMO_TAG_VIEWSETTINGS_ADDITIONALS:
     338           68 :             mySettings.addMode = StringUtils::toInt(attrs.getStringSecure("addMode", toString(mySettings.addMode)));
     339           34 :             mySettings.addSize = parseSizeSettings("add", attrs, mySettings.addSize);
     340           34 :             mySettings.addName = parseTextSettings("addName", attrs, mySettings.addName);
     341           34 :             mySettings.addFullName = parseTextSettings("addFullName", attrs, mySettings.addFullName);
     342              :             // color settings (temporal, will be integrated in a schema
     343           34 :             mySettings.colorSettings.busStopColorSign = parseColor(attrs, "busStopColorSign", mySettings.colorSettings.busStopColorSign);
     344           34 :             mySettings.colorSettings.chargingStationColor = parseColor(attrs, "chargingStationColor", mySettings.colorSettings.chargingStationColor);
     345           34 :             mySettings.colorSettings.chargingStationColorCharge = parseColor(attrs, "chargingStationColorCharge", mySettings.colorSettings.chargingStationColorCharge);
     346           34 :             mySettings.colorSettings.chargingStationColorSign = parseColor(attrs, "chargingStationColorSign", mySettings.colorSettings.chargingStationColorSign);
     347           34 :             mySettings.colorSettings.containerStopColor = parseColor(attrs, "containerStopColor", mySettings.colorSettings.containerStopColor);
     348           34 :             mySettings.colorSettings.containerStopColorSign = parseColor(attrs, "containerStopColorSign", mySettings.colorSettings.containerStopColorSign);
     349           34 :             mySettings.colorSettings.parkingAreaColor = parseColor(attrs, "parkingAreaColor", mySettings.colorSettings.parkingAreaColor);
     350           34 :             mySettings.colorSettings.parkingAreaColorSign = parseColor(attrs, "parkingAreaColorSign", mySettings.colorSettings.parkingAreaColorSign);
     351           34 :             mySettings.colorSettings.parkingSpaceColor = parseColor(attrs, "parkingSpaceColor", mySettings.colorSettings.parkingSpaceColor);
     352           34 :             mySettings.colorSettings.parkingSpaceColorContour = parseColor(attrs, "parkingSpaceColorContour", mySettings.colorSettings.parkingSpaceColorContour);
     353           34 :             mySettings.colorSettings.personTripColor = parseColor(attrs, "personTripColor", mySettings.colorSettings.personTripColor);
     354           34 :             mySettings.colorSettings.rideColor = parseColor(attrs, "rideColor", mySettings.colorSettings.rideColor);
     355           34 :             mySettings.colorSettings.selectedAdditionalColor = parseColor(attrs, "selectedAdditionalColor", mySettings.colorSettings.selectedAdditionalColor);
     356           34 :             mySettings.colorSettings.selectedConnectionColor = parseColor(attrs, "selectedConnectionColor", mySettings.colorSettings.selectedConnectionColor);
     357           34 :             mySettings.colorSettings.selectedContainerColor = parseColor(attrs, "selectedContainerColor", mySettings.colorSettings.selectedContainerColor);
     358           34 :             mySettings.colorSettings.selectedContainerPlanColor = parseColor(attrs, "selectedContainerPlanColor", mySettings.colorSettings.selectedContainerPlanColor);
     359           34 :             mySettings.colorSettings.selectedCrossingColor = parseColor(attrs, "selectedCrossingColor", mySettings.colorSettings.selectedCrossingColor);
     360           34 :             mySettings.colorSettings.selectedEdgeColor = parseColor(attrs, "selectedEdgeColor", mySettings.colorSettings.selectedEdgeColor);
     361           34 :             mySettings.colorSettings.selectedEdgeDataColor = parseColor(attrs, "selectedEdgeDataColor", mySettings.colorSettings.selectedEdgeDataColor);
     362           34 :             mySettings.colorSettings.selectedLaneColor = parseColor(attrs, "selectedLaneColor", mySettings.colorSettings.selectedLaneColor);
     363           34 :             mySettings.colorSettings.selectedPersonColor = parseColor(attrs, "selectedPersonColor", mySettings.colorSettings.selectedPersonColor);
     364           34 :             mySettings.colorSettings.selectedPersonPlanColor = parseColor(attrs, "selectedPersonPlanColor", mySettings.colorSettings.selectedPersonPlanColor);
     365           34 :             mySettings.colorSettings.selectedProhibitionColor = parseColor(attrs, "selectedProhibitionColor", mySettings.colorSettings.selectedProhibitionColor);
     366           34 :             mySettings.colorSettings.selectedRouteColor = parseColor(attrs, "selectedRouteColor", mySettings.colorSettings.selectedRouteColor);
     367           34 :             mySettings.colorSettings.selectedVehicleColor = parseColor(attrs, "selectedVehicleColor", mySettings.colorSettings.selectedVehicleColor);
     368           34 :             mySettings.colorSettings.selectionColor = parseColor(attrs, "selectionColor", mySettings.colorSettings.selectionColor);
     369           34 :             mySettings.colorSettings.stopColor = parseColor(attrs, "stopColor", mySettings.colorSettings.stopColor);
     370           34 :             mySettings.colorSettings.waypointColor = parseColor(attrs, "waypointColor", mySettings.colorSettings.waypointColor);
     371           34 :             mySettings.colorSettings.stopContainerColor = parseColor(attrs, "stopContainerColor", mySettings.colorSettings.stopContainerColor);
     372           34 :             mySettings.colorSettings.stopPersonColor = parseColor(attrs, "stopPersonColor", mySettings.colorSettings.stopPersonColor);
     373           34 :             mySettings.colorSettings.trainStopColor = parseColor(attrs, "trainStopColor", mySettings.colorSettings.trainStopColor);
     374           34 :             mySettings.colorSettings.trainStopColorSign = parseColor(attrs, "trainStopColorSign", mySettings.colorSettings.trainStopColorSign);
     375           34 :             mySettings.colorSettings.transhipColor = parseColor(attrs, "transhipColor", mySettings.colorSettings.transhipColor);
     376           34 :             mySettings.colorSettings.transportColor = parseColor(attrs, "transportColor", mySettings.colorSettings.transportColor);
     377           34 :             mySettings.colorSettings.vehicleTripColor = parseColor(attrs, "vehicleTripColor", mySettings.colorSettings.vehicleTripColor);
     378           34 :             mySettings.colorSettings.walkColor = parseColor(attrs, "walkColor", mySettings.colorSettings.walkColor);
     379           68 :             mySettings.widthSettings.personTripWidth = StringUtils::toDouble(attrs.getStringSecure("personTripWidth", toString(mySettings.widthSettings.personTripWidth)));
     380           68 :             mySettings.widthSettings.rideWidth = StringUtils::toDouble(attrs.getStringSecure("rideWidth", toString(mySettings.widthSettings.rideWidth)));
     381           68 :             mySettings.widthSettings.transhipWidth = StringUtils::toDouble(attrs.getStringSecure("transhipWidth", toString(mySettings.widthSettings.transhipWidth)));
     382           68 :             mySettings.widthSettings.transportWidth = StringUtils::toDouble(attrs.getStringSecure("transportWidth", toString(mySettings.widthSettings.transportWidth)));
     383           68 :             mySettings.widthSettings.tripWidth = StringUtils::toDouble(attrs.getStringSecure("tripWidth", toString(mySettings.widthSettings.tripWidth)));
     384           68 :             mySettings.widthSettings.walkWidth = StringUtils::toDouble(attrs.getStringSecure("walkWidth", toString(mySettings.widthSettings.walkWidth)));
     385           34 :             mySettings.colorSettings.busStopColor = parseColor(attrs, "busStopColor", mySettings.colorSettings.busStopColor);
     386           34 :             break;
     387           34 :         case SUMO_TAG_VIEWSETTINGS_POIS:
     388           34 :             mySettings.poiTextParam = attrs.getStringSecure("poiTextParam", mySettings.poiTextParam);
     389           34 :             mySettings.poiSize = parseSizeSettings("poi", attrs, mySettings.poiSize);
     390           68 :             mySettings.poiDetail = StringUtils::toInt(attrs.getStringSecure("poiDetail", toString(mySettings.poiDetail)));
     391           34 :             mySettings.poiName = parseTextSettings("poiName", attrs, mySettings.poiName);
     392           34 :             mySettings.poiType = parseTextSettings("poiType", attrs, mySettings.poiType);
     393           34 :             mySettings.poiText = parseTextSettings("poiText", attrs, mySettings.poiText);
     394           68 :             mySettings.poiColorer.setActive(StringUtils::toInt(attrs.getStringSecure("personMode", "0")));
     395           68 :             mySettings.poiUseCustomLayer = StringUtils::toBool(attrs.getStringSecure("poiUseCustomLayer", toString(mySettings.poiUseCustomLayer)));
     396           68 :             mySettings.poiCustomLayer = StringUtils::toDouble(attrs.getStringSecure("poiCustomLayer", toString(mySettings.poiCustomLayer)));
     397           34 :             myCurrentColorer = element;
     398           34 :             break;
     399              :         case SUMO_TAG_VIEWSETTINGS_POLYS:
     400           30 :             mySettings.polySize = parseSizeSettings("poly", attrs, mySettings.polySize);
     401           30 :             mySettings.polyName = parseTextSettings("polyName", attrs, mySettings.polyName);
     402           30 :             mySettings.polyType = parseTextSettings("polyType", attrs, mySettings.polyType);
     403           60 :             mySettings.polyColorer.setActive(StringUtils::toInt(attrs.getStringSecure("personMode", "0")));
     404           60 :             mySettings.polyUseCustomLayer = StringUtils::toBool(attrs.getStringSecure("polyUseCustomLayer", toString(mySettings.polyUseCustomLayer)));
     405           60 :             mySettings.polyCustomLayer = StringUtils::toDouble(attrs.getStringSecure("polyCustomLayer", toString(mySettings.polyCustomLayer)));
     406           30 :             myCurrentColorer = element;
     407           30 :             break;
     408            0 :         case SUMO_TAG_VIEWSETTINGS_DATA:
     409            0 :             mySettings.dataColorer.setActive(StringUtils::toInt(attrs.getStringSecure("dataMode", "0")));
     410            0 :             mySettings.dataScaler.setActive(StringUtils::toInt(attrs.getStringSecure("dataScaleMode", "0")));
     411            0 :             mySettings.dataValueRainBow = parseRainbowSettings("dataValueRainbow", attrs, mySettings.dataValueRainBow);
     412            0 :             mySettings.dataValue = parseTextSettings("dataValue", attrs, mySettings.dataValue);
     413            0 :             mySettings.tazRelWidthExaggeration = StringUtils::toDouble(attrs.getStringSecure("tazRelExaggeration", toString(mySettings.tazRelWidthExaggeration)));
     414            0 :             mySettings.edgeRelWidthExaggeration = StringUtils::toDouble(attrs.getStringSecure("edgeRelExaggeration", toString(mySettings.edgeRelWidthExaggeration)));
     415            0 :             mySettings.relDataAttr = attrs.getStringSecure("relDataAttr", mySettings.relDataAttr);
     416            0 :             mySettings.relDataScaleAttr = attrs.getStringSecure("relDataScaleAttr", mySettings.relDataScaleAttr);
     417            0 :             myCurrentColorer = element;
     418            0 :             break;
     419           34 :         case SUMO_TAG_VIEWSETTINGS_LEGEND:
     420           68 :             mySettings.showSizeLegend = StringUtils::toBool(attrs.getStringSecure("showSizeLegend", toString(mySettings.showSizeLegend)));
     421           68 :             mySettings.showColorLegend = StringUtils::toBool(attrs.getStringSecure("showColorLegend", toString(mySettings.showColorLegend)));
     422           68 :             mySettings.showVehicleColorLegend = StringUtils::toBool(attrs.getStringSecure("showVehicleColorLegend", toString(mySettings.showVehicleColorLegend)));
     423           34 :             break;
     424              :         case SUMO_TAG_VIEWSETTINGS_DECAL: {
     425              :             GUISUMOAbstractView::Decal d;
     426            7 :             if (attrs.hasAttribute(SUMO_ATTR_FILE)) {
     427           12 :                 d.filename = StringUtils::substituteEnvironment(attrs.get<std::string>(SUMO_ATTR_FILE, nullptr, ok));
     428              :             } else {
     429            1 :                 d.filename = attrs.getStringSecure("filename", d.filename);
     430            2 :                 WRITE_WARNING(TL("The 'filename' attribute is deprecated for decals. Please use 'file'."));
     431              :             }
     432            7 :             if (d.filename != "" && !FileHelpers::isAbsolute(d.filename)) {
     433           14 :                 d.filename = FileHelpers::getConfigurationRelative(getFileName(), d.filename);
     434              :             }
     435            7 :             d.centerX = attrs.getOpt<double>(SUMO_ATTR_CENTER_X, nullptr, ok, d.centerX);
     436            7 :             d.centerY = attrs.getOpt<double>(SUMO_ATTR_CENTER_Y, nullptr, ok, d.centerY);
     437            7 :             d.centerZ = attrs.getOpt<double>(SUMO_ATTR_CENTER_Z, nullptr, ok, d.centerZ);
     438            7 :             d.width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, nullptr, ok, d.width);
     439            7 :             d.height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, nullptr, ok, d.height);
     440           14 :             d.altitude = StringUtils::toDouble(attrs.getStringSecure("altitude", "0"));
     441           14 :             d.rot = StringUtils::toDouble(attrs.getStringSecure("rotation", toString(d.rot)));
     442           14 :             d.tilt = StringUtils::toDouble(attrs.getStringSecure("tilt", toString(d.tilt)));
     443           14 :             d.roll = StringUtils::toDouble(attrs.getStringSecure("roll", toString(d.roll)));
     444            7 :             d.layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, nullptr, ok, d.layer);
     445           14 :             d.screenRelative = StringUtils::toBool(attrs.getStringSecure("screenRelative", toString(d.screenRelative)));
     446            7 :             d.initialised = false;
     447            7 :             myDecals.push_back(d);
     448              :         }
     449            7 :         break;
     450            0 :         case SUMO_TAG_VIEWSETTINGS_TRACKER: {
     451            0 :             myTrackers.push_back(attrs.get<std::string>(SUMO_ATTR_TLID, nullptr, ok));
     452              :         }
     453            0 :         break;
     454              :         case SUMO_TAG_VIEWSETTINGS_LIGHT: {
     455              :             GUISUMOAbstractView::Decal d;
     456            0 :             d.filename = "light" + attrs.getOpt<std::string>(SUMO_ATTR_INDEX, nullptr, ok, "0");
     457            0 :             d.centerX = attrs.getOpt<double>(SUMO_ATTR_CENTER_X, nullptr, ok, d.centerX);
     458            0 :             d.centerY = attrs.getOpt<double>(SUMO_ATTR_CENTER_Y, nullptr, ok, d.centerY);
     459            0 :             d.centerZ = attrs.getOpt<double>(SUMO_ATTR_CENTER_Z, nullptr, ok, d.centerZ);
     460            0 :             d.width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, nullptr, ok, d.width);
     461            0 :             d.height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, nullptr, ok, d.height);
     462            0 :             d.altitude = StringUtils::toDouble(attrs.getStringSecure("altitude", "0"));
     463            0 :             d.rot = StringUtils::toDouble(attrs.getStringSecure("rotation", toString(d.rot)));
     464            0 :             d.tilt = StringUtils::toDouble(attrs.getStringSecure("tilt", toString(d.tilt)));
     465            0 :             d.roll = StringUtils::toDouble(attrs.getStringSecure("roll", toString(d.roll)));
     466            0 :             d.layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, nullptr, ok, d.layer);
     467            0 :             d.initialised = false;
     468            0 :             myDecals.push_back(d);
     469              :         }
     470            0 :         break;
     471            0 :         case SUMO_TAG_VIEWSETTINGS_EVENT: {
     472            0 :             const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
     473            0 :             const std::string cmd = attrs.get<std::string>(SUMO_ATTR_COMMAND, nullptr, ok);
     474            0 :             const double prob = attrs.get<double>(SUMO_ATTR_PROB, id.c_str(), ok);
     475            0 :             myEventDistributions[id].add(cmd, prob);
     476              :         }
     477            0 :         break;
     478            0 :         case SUMO_TAG_VIEWSETTINGS_EVENT_JAM_TIME:
     479            0 :             myJamSoundTime = attrs.get<double>(SUMO_ATTR_VALUE, nullptr, ok);
     480            0 :             break;
     481              :         default:
     482              :             break;
     483              :     }
     484        18748 : }
     485              : 
     486              : void
     487        18748 : GUISettingsHandler::myEndElement(int element) {
     488        18748 :     switch (element) {
     489           34 :         case SUMO_TAG_VIEWSETTINGS_SCHEME: {
     490           34 :             if (mySettings.name != "") {
     491           34 :                 gSchemeStorage.add(mySettings);
     492           34 :                 myLoadedSettingNames.push_back(mySettings.name);
     493              :             }
     494              :         }
     495              :     }
     496        18748 : }
     497              : 
     498              : 
     499              : RGBColor
     500         1262 : GUISettingsHandler::parseColor(const SUMOSAXAttributes& attrs, const std::string attribute, const RGBColor& defaultValue) const {
     501         1262 :     bool ok = true;
     502         2524 :     return RGBColor::parseColorReporting(attrs.getStringSecure(attribute, toString(defaultValue)), attribute.c_str(), nullptr, true, ok);
     503              : }
     504              : 
     505              : 
     506              : GUIVisualizationTextSettings
     507          920 : GUISettingsHandler::parseTextSettings(
     508              :     const std::string& prefix, const SUMOSAXAttributes& attrs,
     509              :     GUIVisualizationTextSettings defaults) {
     510          920 :     bool ok = true;
     511              :     return GUIVisualizationTextSettings(
     512         1840 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_show", toString(defaults.showText))),
     513         1840 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "_size", toString(defaults.size))),
     514         1840 :                RGBColor::parseColorReporting(attrs.getStringSecure(prefix + "_color", toString(defaults.color)), "textSettings", nullptr, true, ok),
     515         1840 :                RGBColor::parseColorReporting(attrs.getStringSecure(prefix + "_bgColor", toString(defaults.bgColor)), "textSettings", nullptr, true, ok),
     516         1840 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_constantSize", toString(defaults.constSize))),
     517         8280 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_onlySelected", toString(defaults.onlySelected))));
     518              : }
     519              : 
     520              : 
     521              : GUIVisualizationSizeSettings
     522          218 : GUISettingsHandler::parseSizeSettings(
     523              :     const std::string& prefix, const SUMOSAXAttributes& attrs,
     524              :     GUIVisualizationSizeSettings defaults) {
     525              :     return GUIVisualizationSizeSettings(
     526          436 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "_minSize", toString(defaults.minSize))),
     527          436 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "_exaggeration", toString(defaults.exaggeration))),
     528          436 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_constantSize", toString(defaults.constantSize))),
     529         1090 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_constantSizeSelected", toString(defaults.constantSizeSelected))));
     530              : }
     531              : 
     532              : GUIVisualizationRainbowSettings
     533          102 : GUISettingsHandler::parseRainbowSettings(
     534              :     const std::string& prefix, const SUMOSAXAttributes& attrs,
     535              :     GUIVisualizationRainbowSettings defaults) {
     536              :     return GUIVisualizationRainbowSettings(
     537          204 :                StringUtils::toBool(attrs.getStringSecure(prefix + "HideCheck", toString(defaults.hideMin))),
     538          204 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "HideThreshold", toString(defaults.minThreshold))),
     539          204 :                StringUtils::toBool(attrs.getStringSecure(prefix + "HideCheck2", toString(defaults.hideMax))),
     540          204 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "HideThreshold2", toString(defaults.maxThreshold))),
     541          204 :                StringUtils::toBool(attrs.getStringSecure(prefix + "SetNeutral", toString(defaults.hideMax))),
     542          204 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "NeutralThreshold", toString(defaults.neutralThreshold))),
     543          204 :                StringUtils::toBool(attrs.getStringSecure(prefix + "FixRange", toString(defaults.fixRange))),
     544          918 :                StringUtils::toInt(attrs.getStringSecure(prefix + "RainbowScheme", toString(defaults.rainbowScheme))));
     545              : }
     546              : 
     547              : const std::vector<std::string>&
     548            0 : GUISettingsHandler::addSettings(GUISUMOAbstractView* view) const {
     549            0 :     if (view) {
     550            0 :         for (std::string name : myLoadedSettingNames) {
     551            0 :             FXint index = view->getColoringSchemesCombo()->appendIconItem(name.c_str());
     552            0 :             view->getColoringSchemesCombo()->setCurrentItem(index);
     553            0 :             view->setColorScheme(name);
     554              :         }
     555              :     }
     556            0 :     return myLoadedSettingNames;
     557              : }
     558              : 
     559              : 
     560              : void
     561           37 : GUISettingsHandler::applyViewport(GUISUMOAbstractView* view) const {
     562           37 :     if (myLookFrom.z() > 0 || myZoom > 0) {
     563              :         // z value stores zoom so we must convert first
     564            6 :         double z = (view->is3DView()) ? myLookFrom.z() : view->getChanger().zoom2ZPos(myZoom);
     565            6 :         if (view->is3DView() && !myZCoordSet) { // set view angle to ground to at least 45 degrees if no Z coordinate is given
     566            0 :             z = myLookFrom.distanceTo2D(myLookAt) * sin(PI * 0.25);
     567              :         }
     568              :         Position lookFrom(myLookFrom.x(), myLookFrom.y(), z);
     569            6 :         view->setViewportFromToRot(lookFrom, myLookAt, myRotation);
     570            6 :         if (view->is3DView() && !myZCoordSet) {
     571            0 :             view->recenterView();
     572              :         }
     573              :     }
     574           37 : }
     575              : 
     576              : 
     577              : void
     578           37 : GUISettingsHandler::setSnapshots(GUISUMOAbstractView* view) const {
     579           37 :     if (!mySnapshots.empty()) {
     580            2 :         for (auto item : mySnapshots) {
     581            3 :             for (auto file : item.second) {
     582            2 :                 view->addSnapshot(item.first, file);
     583              :             }
     584              :         }
     585              :     }
     586           37 : }
     587              : 
     588              : 
     589              : bool
     590            0 : GUISettingsHandler::hasDecals() const {
     591            0 :     return !myDecals.empty();
     592              : }
     593              : 
     594              : 
     595              : const std::vector<GUISUMOAbstractView::Decal>&
     596           37 : GUISettingsHandler::getDecals() const {
     597           37 :     return myDecals;
     598              : }
     599              : 
     600              : 
     601              : double
     602           42 : GUISettingsHandler::getDelay() const {
     603           42 :     return myDelay;
     604              : }
     605              : 
     606              : 
     607              : std::vector<SUMOTime>
     608            0 : GUISettingsHandler::loadBreakpoints(const std::string& file) {
     609              :     std::vector<SUMOTime> result;
     610            0 :     std::ifstream strm(file.c_str());
     611            0 :     if (!strm.good()) {
     612            0 :         WRITE_ERRORF(TL("Could not open '%'."), file);
     613            0 :         return result;
     614              :     }
     615            0 :     while (strm.good()) {
     616              :         std::string val;
     617            0 :         strm >> val;
     618            0 :         if (val.length() == 0) {
     619              :             continue;
     620              :         }
     621              :         try {
     622            0 :             SUMOTime value = string2time(val);
     623            0 :             result.push_back(value);
     624            0 :         } catch (NumberFormatException& e) {
     625            0 :             WRITE_ERRORF(TL("A breakpoint value must be a time description (%)."), toString(e.what()));
     626            0 :         } catch (EmptyData&) {
     627            0 :         } catch (ProcessError&) {
     628            0 :             WRITE_ERRORF(TL("Could not decode breakpoint '%'."), val);
     629            0 :         }
     630              :     }
     631              :     return result;
     632            0 : }
     633              : 
     634              : 
     635              : RandomDistributor<std::string>
     636           74 : GUISettingsHandler::getEventDistribution(const std::string& id) {
     637           74 :     RandomDistributor<std::string> result = myEventDistributions[id];
     638           74 :     if (result.getOverallProb() > 0 && result.getOverallProb() < 1) {
     639              :         // unscaled probabilities are assumed, fill up with dummy event
     640            0 :         result.add("", 1. - result.getOverallProb());
     641              :     }
     642           74 :     return result;
     643              : }
     644              : 
     645              : 
     646              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1