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

Generated by: LCOV version 2.0-1