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

Generated by: LCOV version 2.0-1