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 % 409 347
Test Date: 2024-11-20 15:55:46 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-2024 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.vehicleParam = attrs.getStringSecure("vehicleParam", mySettings.vehicleParam);
     165           32 :             mySettings.vehicleScaleParam = attrs.getStringSecure("vehicleScaleParam", mySettings.vehicleScaleParam);
     166           32 :             mySettings.vehicleTextParam = attrs.getStringSecure("vehicleTextParam", mySettings.vehicleTextParam);
     167           32 :             mySettings.edgeData = attrs.getStringSecure("edgeData", mySettings.edgeData);
     168           32 :             mySettings.edgeDataID = attrs.getStringSecure("edgeDataID", mySettings.edgeDataID);
     169           64 :             mySettings.edgeDataScaling = attrs.getStringSecure("edgeDataScaling", mySettings.edgeDataScaling);
     170           64 :             mySettings.edgeValueRainBow = parseRainbowSettings("edgeValue", attrs, mySettings.edgeValueRainBow);
     171           32 :             myCurrentColorer = element;
     172              :             mySettings.edgeColorer.setActive(laneEdgeMode);
     173              :             mySettings.edgeScaler.setActive(laneEdgeScaleMode);
     174              :             mySettings.laneColorer.setActive(laneEdgeMode);
     175              :             mySettings.laneScaler.setActive(laneEdgeScaleMode);
     176              :         }
     177              :         break;
     178         3044 :         case SUMO_TAG_COLORSCHEME: {
     179         3044 :             myCurrentScheme = nullptr;
     180         3044 :             myCurrentScaleScheme = nullptr;
     181         3044 :             const std::string name = attrs.getStringSecure(SUMO_ATTR_NAME, "");
     182         3044 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_EDGES) {
     183         2824 :                 if (StringUtils::startsWith(name, "meso:")) {
     184              :                     // see edgeColorer.save() in GUIVisualizationSettings::save
     185          800 :                     myCurrentScheme = mySettings.edgeColorer.getSchemeByName(name.substr(5));
     186              :                 } else {
     187         1012 :                     myCurrentScheme = mySettings.laneColorer.getSchemeByName(name);
     188              :                 }
     189         1412 :                 if (myCurrentScheme == nullptr) {
     190              :                     // legacy: meso schemes without prefix
     191           68 :                     myCurrentScheme = mySettings.edgeColorer.getSchemeByName(name);
     192              :                 }
     193              :             }
     194         3044 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_VEHICLES) {
     195          898 :                 myCurrentScheme = mySettings.vehicleColorer.getSchemeByName(name);
     196              :             }
     197         3044 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_PERSONS) {
     198          260 :                 myCurrentScheme = mySettings.personColorer.getSchemeByName(name);
     199              :             }
     200         3044 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_JUNCTIONS) {
     201          102 :                 myCurrentScheme = mySettings.junctionColorer.getSchemeByName(name);
     202              :             }
     203         3044 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_POIS) {
     204           66 :                 myCurrentScheme = mySettings.poiColorer.getSchemeByName(name);
     205              :             }
     206         3044 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_POLYS) {
     207           68 :                 myCurrentScheme = mySettings.polyColorer.getSchemeByName(name);
     208              :             }
     209         3044 :             if (myCurrentScheme && !myCurrentScheme->isFixed()) {
     210         1764 :                 myCurrentScheme->setInterpolated(attrs.getOpt<bool>(SUMO_ATTR_INTERPOLATED, nullptr, ok, false));
     211         1764 :                 myCurrentScheme->clear();
     212              :             }
     213              :         }
     214         3044 :         break;
     215          757 :         case SUMO_TAG_SCALINGSCHEME:
     216          757 :             myCurrentScheme = nullptr;
     217          757 :             myCurrentScaleScheme = nullptr;
     218          757 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_EDGES) {
     219         1454 :                 myCurrentScaleScheme = mySettings.laneScaler.getSchemeByName(attrs.getStringSecure(SUMO_ATTR_NAME, ""));
     220          727 :                 if (myCurrentScaleScheme == nullptr) {
     221          402 :                     myCurrentScaleScheme = mySettings.edgeScaler.getSchemeByName(attrs.getStringSecure(SUMO_ATTR_NAME, ""));
     222              :                 }
     223              :             }
     224          757 :             if (myCurrentColorer == SUMO_TAG_VIEWSETTINGS_VEHICLES) {
     225           90 :                 myCurrentScaleScheme = mySettings.vehicleScaler.getSchemeByName(attrs.getStringSecure(SUMO_ATTR_NAME, ""));
     226              :             }
     227          757 :             if (myCurrentScaleScheme && !myCurrentScaleScheme->isFixed()) {
     228          661 :                 myCurrentScaleScheme->setInterpolated(attrs.getOpt<bool>(SUMO_ATTR_INTERPOLATED, nullptr, ok, false));
     229          661 :                 myCurrentScaleScheme->clear();
     230              :             }
     231              :             break;
     232        12915 :         case SUMO_TAG_ENTRY:
     233        12915 :             if (myCurrentScheme != nullptr) {
     234        10476 :                 RGBColor color = attrs.get<RGBColor>(SUMO_ATTR_COLOR, nullptr, ok);
     235        10476 :                 if (myCurrentScheme->isFixed()) {
     236         3940 :                     myCurrentScheme->setColor(attrs.getStringSecure(SUMO_ATTR_NAME, ""), color);
     237              :                 } else {
     238         8506 :                     myCurrentScheme->addColor(color,
     239              :                                               attrs.getOpt<double>(SUMO_ATTR_THRESHOLD, nullptr, ok, std::numeric_limits<double>::max()),
     240        17012 :                                               attrs.getStringSecure(SUMO_ATTR_NAME, ""));
     241              :                 }
     242         2439 :             } else if (myCurrentScaleScheme != nullptr) {
     243         1729 :                 double scale = attrs.get<double>(SUMO_ATTR_COLOR, nullptr, ok);
     244         1729 :                 if (myCurrentScaleScheme->isFixed()) {
     245          280 :                     myCurrentScaleScheme->setColor(attrs.getStringSecure(SUMO_ATTR_NAME, ""), scale);
     246              :                 } else {
     247         1589 :                     myCurrentScaleScheme->addColor(scale,
     248              :                                                    attrs.getOpt<double>(SUMO_ATTR_THRESHOLD, nullptr, ok, std::numeric_limits<double>::max()),
     249         3178 :                                                    attrs.getStringSecure(SUMO_ATTR_NAME, ""));
     250              :                 }
     251              :             }
     252              :             break;
     253           32 :         case SUMO_TAG_VIEWSETTINGS_VEHICLES:
     254           64 :             mySettings.vehicleColorer.setActive(StringUtils::toInt(attrs.getStringSecure("vehicleMode", "0")));
     255           64 :             mySettings.vehicleScaler.setActive(StringUtils::toInt(attrs.getStringSecure("vehicleScaleMode", "0")));
     256           64 :             mySettings.vehicleQuality = StringUtils::toInt(attrs.getStringSecure("vehicleQuality", toString(mySettings.vehicleQuality)));
     257           64 :             mySettings.showBlinker = StringUtils::toBool(attrs.getStringSecure("showBlinker", toString(mySettings.showBlinker)));
     258           64 :             mySettings.drawMinGap = StringUtils::toBool(attrs.getStringSecure("drawMinGap", toString(mySettings.drawMinGap)));
     259           64 :             mySettings.drawBrakeGap = StringUtils::toBool(attrs.getStringSecure("drawBrakeGap", toString(mySettings.drawBrakeGap)));
     260           64 :             mySettings.showBTRange = StringUtils::toBool(attrs.getStringSecure("showBTRange", toString(mySettings.showBTRange)));
     261           64 :             mySettings.showRouteIndex = StringUtils::toBool(attrs.getStringSecure("showRouteIndex", toString(mySettings.showRouteIndex)));
     262           64 :             mySettings.scaleLength = StringUtils::toBool(attrs.getStringSecure("scaleLength", toString(mySettings.scaleLength)));
     263           64 :             mySettings.drawReversed = StringUtils::toBool(attrs.getStringSecure("drawReversed", toString(mySettings.drawReversed)));
     264           64 :             mySettings.showParkingInfo = StringUtils::toBool(attrs.getStringSecure("showParkingInfo", toString(mySettings.showParkingInfo)));
     265           64 :             mySettings.showChargingInfo = StringUtils::toBool(attrs.getStringSecure("showChargingInfo", toString(mySettings.showChargingInfo)));
     266           32 :             mySettings.vehicleSize = parseSizeSettings("vehicle", attrs, mySettings.vehicleSize);
     267           32 :             mySettings.vehicleName = parseTextSettings("vehicleName", attrs, mySettings.vehicleName);
     268           32 :             mySettings.vehicleValue = parseTextSettings("vehicleValue", attrs, mySettings.vehicleValue);
     269           32 :             mySettings.vehicleScaleValue = parseTextSettings("vehicleScaleValue", attrs, mySettings.vehicleScaleValue);
     270           32 :             mySettings.vehicleText = parseTextSettings("vehicleText", attrs, mySettings.vehicleText);
     271           32 :             myCurrentColorer = element;
     272           32 :             break;
     273           24 :         case SUMO_TAG_VIEWSETTINGS_PERSONS:
     274           48 :             mySettings.personColorer.setActive(StringUtils::toInt(attrs.getStringSecure("personMode", "0")));
     275           48 :             mySettings.personQuality = StringUtils::toInt(attrs.getStringSecure("personQuality", toString(mySettings.personQuality)));
     276           24 :             mySettings.personSize = parseSizeSettings("person", attrs, mySettings.personSize);
     277           24 :             mySettings.personName = parseTextSettings("personName", attrs, mySettings.personName);
     278           24 :             mySettings.personValue = parseTextSettings("personValue", attrs, mySettings.personValue);
     279           48 :             mySettings.showPedestrianNetwork = StringUtils::toBool(attrs.getStringSecure("showPedestrianNetwork", toString(mySettings.showPedestrianNetwork)));
     280           48 :             mySettings.pedestrianNetworkColor = RGBColor::parseColorReporting(attrs.getStringSecure("pedestrianNetworkColor", toString(mySettings.pedestrianNetworkColor)), "pedestrianNetworkColor", nullptr, true, ok);
     281           24 :             myCurrentColorer = element;
     282           24 :             break;
     283           24 :         case SUMO_TAG_VIEWSETTINGS_CONTAINERS:
     284           48 :             mySettings.containerColorer.setActive(StringUtils::toInt(attrs.getStringSecure("containerMode", "0")));
     285           48 :             mySettings.containerQuality = StringUtils::toInt(attrs.getStringSecure("containerQuality", toString(mySettings.containerQuality)));
     286           24 :             mySettings.containerSize = parseSizeSettings("container", attrs, mySettings.containerSize);
     287           24 :             mySettings.containerName = parseTextSettings("containerName", attrs, mySettings.containerName);
     288           24 :             myCurrentColorer = element;
     289           24 :             break;
     290           32 :         case SUMO_TAG_VIEWSETTINGS_JUNCTIONS:
     291           64 :             mySettings.junctionColorer.setActive(StringUtils::toInt(attrs.getStringSecure("junctionMode", "0")));
     292           32 :             mySettings.drawLinkTLIndex = parseTextSettings("drawLinkTLIndex", attrs, mySettings.drawLinkTLIndex);
     293           32 :             mySettings.drawLinkJunctionIndex = parseTextSettings("drawLinkJunctionIndex", attrs, mySettings.drawLinkJunctionIndex);
     294           32 :             mySettings.junctionID = parseTextSettings("junctionID", attrs, mySettings.junctionID);
     295           32 :             mySettings.junctionName = parseTextSettings("junctionName", attrs, mySettings.junctionName);
     296           32 :             mySettings.internalJunctionName = parseTextSettings("internalJunctionName", attrs, mySettings.internalJunctionName);
     297           32 :             mySettings.tlsPhaseIndex = parseTextSettings("tlsPhaseIndex", attrs, mySettings.tlsPhaseIndex);
     298           32 :             mySettings.tlsPhaseName = parseTextSettings("tlsPhaseName", attrs, mySettings.tlsPhaseName);
     299           64 :             mySettings.showLane2Lane = StringUtils::toBool(attrs.getStringSecure("showLane2Lane", toString(mySettings.showLane2Lane)));
     300           64 :             mySettings.drawJunctionShape = StringUtils::toBool(attrs.getStringSecure("drawShape", toString(mySettings.drawJunctionShape)));
     301           64 :             mySettings.drawCrossingsAndWalkingareas = StringUtils::toBool(attrs.getStringSecure(
     302           32 :                         "drawCrossingsAndWalkingareas", toString(mySettings.drawCrossingsAndWalkingareas)));
     303           32 :             mySettings.junctionSize = parseSizeSettings("junction", attrs, mySettings.junctionSize);
     304           64 :             mySettings.junctionValueRainBow = parseRainbowSettings("junctionValue", attrs, mySettings.junctionValueRainBow);
     305           32 :             myCurrentColorer = element;
     306           32 :             break;
     307           32 :         case SUMO_TAG_VIEWSETTINGS_ADDITIONALS:
     308           64 :             mySettings.addMode = StringUtils::toInt(attrs.getStringSecure("addMode", toString(mySettings.addMode)));
     309           32 :             mySettings.addSize = parseSizeSettings("add", attrs, mySettings.addSize);
     310           32 :             mySettings.addName = parseTextSettings("addName", attrs, mySettings.addName);
     311           32 :             mySettings.addFullName = parseTextSettings("addFullName", attrs, mySettings.addFullName);
     312              :             // color settings (temporal, will be integrated in a schema
     313           32 :             mySettings.colorSettings.busStopColorSign = parseColor(attrs, "busStopColorSign", mySettings.colorSettings.busStopColorSign);
     314           32 :             mySettings.colorSettings.chargingStationColor = parseColor(attrs, "chargingStationColor", mySettings.colorSettings.chargingStationColor);
     315           32 :             mySettings.colorSettings.chargingStationColorCharge = parseColor(attrs, "chargingStationColorCharge", mySettings.colorSettings.chargingStationColorCharge);
     316           32 :             mySettings.colorSettings.chargingStationColorSign = parseColor(attrs, "chargingStationColorSign", mySettings.colorSettings.chargingStationColorSign);
     317           32 :             mySettings.colorSettings.containerStopColor = parseColor(attrs, "containerStopColor", mySettings.colorSettings.containerStopColor);
     318           32 :             mySettings.colorSettings.containerStopColorSign = parseColor(attrs, "containerStopColorSign", mySettings.colorSettings.containerStopColorSign);
     319           32 :             mySettings.colorSettings.parkingAreaColor = parseColor(attrs, "parkingAreaColor", mySettings.colorSettings.parkingAreaColor);
     320           32 :             mySettings.colorSettings.parkingAreaColorSign = parseColor(attrs, "parkingAreaColorSign", mySettings.colorSettings.parkingAreaColorSign);
     321           32 :             mySettings.colorSettings.parkingSpaceColor = parseColor(attrs, "parkingSpaceColor", mySettings.colorSettings.parkingSpaceColor);
     322           32 :             mySettings.colorSettings.parkingSpaceColorContour = parseColor(attrs, "parkingSpaceColorContour", mySettings.colorSettings.parkingSpaceColorContour);
     323           32 :             mySettings.colorSettings.personTripColor = parseColor(attrs, "personTripColor", mySettings.colorSettings.personTripColor);
     324           32 :             mySettings.colorSettings.rideColor = parseColor(attrs, "rideColor", mySettings.colorSettings.rideColor);
     325           32 :             mySettings.colorSettings.selectedAdditionalColor = parseColor(attrs, "selectedAdditionalColor", mySettings.colorSettings.selectedAdditionalColor);
     326           32 :             mySettings.colorSettings.selectedConnectionColor = parseColor(attrs, "selectedConnectionColor", mySettings.colorSettings.selectedConnectionColor);
     327           32 :             mySettings.colorSettings.selectedContainerColor = parseColor(attrs, "selectedContainerColor", mySettings.colorSettings.selectedContainerColor);
     328           32 :             mySettings.colorSettings.selectedContainerPlanColor = parseColor(attrs, "selectedContainerPlanColor", mySettings.colorSettings.selectedContainerPlanColor);
     329           32 :             mySettings.colorSettings.selectedCrossingColor = parseColor(attrs, "selectedCrossingColor", mySettings.colorSettings.selectedCrossingColor);
     330           32 :             mySettings.colorSettings.selectedEdgeColor = parseColor(attrs, "selectedEdgeColor", mySettings.colorSettings.selectedEdgeColor);
     331           32 :             mySettings.colorSettings.selectedEdgeDataColor = parseColor(attrs, "selectedEdgeDataColor", mySettings.colorSettings.selectedEdgeDataColor);
     332           32 :             mySettings.colorSettings.selectedLaneColor = parseColor(attrs, "selectedLaneColor", mySettings.colorSettings.selectedLaneColor);
     333           32 :             mySettings.colorSettings.selectedPersonColor = parseColor(attrs, "selectedPersonColor", mySettings.colorSettings.selectedPersonColor);
     334           32 :             mySettings.colorSettings.selectedPersonPlanColor = parseColor(attrs, "selectedPersonPlanColor", mySettings.colorSettings.selectedPersonPlanColor);
     335           32 :             mySettings.colorSettings.selectedProhibitionColor = parseColor(attrs, "selectedProhibitionColor", mySettings.colorSettings.selectedProhibitionColor);
     336           32 :             mySettings.colorSettings.selectedRouteColor = parseColor(attrs, "selectedRouteColor", mySettings.colorSettings.selectedRouteColor);
     337           32 :             mySettings.colorSettings.selectedVehicleColor = parseColor(attrs, "selectedVehicleColor", mySettings.colorSettings.selectedVehicleColor);
     338           32 :             mySettings.colorSettings.selectionColor = parseColor(attrs, "selectionColor", mySettings.colorSettings.selectionColor);
     339           32 :             mySettings.colorSettings.stopColor = parseColor(attrs, "stopColor", mySettings.colorSettings.stopColor);
     340           32 :             mySettings.colorSettings.waypointColor = parseColor(attrs, "waypointColor", mySettings.colorSettings.waypointColor);
     341           32 :             mySettings.colorSettings.stopContainerColor = parseColor(attrs, "stopContainerColor", mySettings.colorSettings.stopContainerColor);
     342           32 :             mySettings.colorSettings.stopPersonColor = parseColor(attrs, "stopPersonColor", mySettings.colorSettings.stopPersonColor);
     343           32 :             mySettings.colorSettings.trainStopColor = parseColor(attrs, "trainStopColor", mySettings.colorSettings.trainStopColor);
     344           32 :             mySettings.colorSettings.trainStopColorSign = parseColor(attrs, "trainStopColorSign", mySettings.colorSettings.trainStopColorSign);
     345           32 :             mySettings.colorSettings.transhipColor = parseColor(attrs, "transhipColor", mySettings.colorSettings.transhipColor);
     346           32 :             mySettings.colorSettings.transportColor = parseColor(attrs, "transportColor", mySettings.colorSettings.transportColor);
     347           32 :             mySettings.colorSettings.vehicleTripColor = parseColor(attrs, "vehicleTripColor", mySettings.colorSettings.vehicleTripColor);
     348           32 :             mySettings.colorSettings.walkColor = parseColor(attrs, "walkColor", mySettings.colorSettings.walkColor);
     349           64 :             mySettings.widthSettings.personTripWidth = StringUtils::toDouble(attrs.getStringSecure("personTripWidth", toString(mySettings.widthSettings.personTripWidth)));
     350           64 :             mySettings.widthSettings.rideWidth = StringUtils::toDouble(attrs.getStringSecure("rideWidth", toString(mySettings.widthSettings.rideWidth)));
     351           64 :             mySettings.widthSettings.transhipWidth = StringUtils::toDouble(attrs.getStringSecure("transhipWidth", toString(mySettings.widthSettings.transhipWidth)));
     352           64 :             mySettings.widthSettings.transportWidth = StringUtils::toDouble(attrs.getStringSecure("transportWidth", toString(mySettings.widthSettings.transportWidth)));
     353           64 :             mySettings.widthSettings.tripWidth = StringUtils::toDouble(attrs.getStringSecure("tripWidth", toString(mySettings.widthSettings.tripWidth)));
     354           64 :             mySettings.widthSettings.walkWidth = StringUtils::toDouble(attrs.getStringSecure("walkWidth", toString(mySettings.widthSettings.walkWidth)));
     355           32 :             mySettings.colorSettings.busStopColor = parseColor(attrs, "busStopColor", mySettings.colorSettings.busStopColor);
     356           32 :             break;
     357           32 :         case SUMO_TAG_VIEWSETTINGS_POIS:
     358           32 :             mySettings.poiTextParam = attrs.getStringSecure("poiTextParam", mySettings.poiTextParam);
     359           32 :             mySettings.poiSize = parseSizeSettings("poi", attrs, mySettings.poiSize);
     360           64 :             mySettings.poiDetail = StringUtils::toInt(attrs.getStringSecure("poiDetail", toString(mySettings.poiDetail)));
     361           32 :             mySettings.poiName = parseTextSettings("poiName", attrs, mySettings.poiName);
     362           32 :             mySettings.poiType = parseTextSettings("poiType", attrs, mySettings.poiType);
     363           32 :             mySettings.poiText = parseTextSettings("poiText", attrs, mySettings.poiText);
     364           64 :             mySettings.poiColorer.setActive(StringUtils::toInt(attrs.getStringSecure("personMode", "0")));
     365           64 :             mySettings.poiUseCustomLayer = StringUtils::toBool(attrs.getStringSecure("poiUseCustomLayer", toString(mySettings.poiUseCustomLayer)));
     366           64 :             mySettings.poiCustomLayer = StringUtils::toDouble(attrs.getStringSecure("poiCustomLayer", toString(mySettings.poiCustomLayer)));
     367           32 :             myCurrentColorer = element;
     368           32 :             break;
     369              :         case SUMO_TAG_VIEWSETTINGS_POLYS:
     370           28 :             mySettings.polySize = parseSizeSettings("poly", attrs, mySettings.polySize);
     371           28 :             mySettings.polyName = parseTextSettings("polyName", attrs, mySettings.polyName);
     372           28 :             mySettings.polyType = parseTextSettings("polyType", attrs, mySettings.polyType);
     373           56 :             mySettings.polyColorer.setActive(StringUtils::toInt(attrs.getStringSecure("personMode", "0")));
     374           56 :             mySettings.polyUseCustomLayer = StringUtils::toBool(attrs.getStringSecure("polyUseCustomLayer", toString(mySettings.polyUseCustomLayer)));
     375           56 :             mySettings.polyCustomLayer = StringUtils::toDouble(attrs.getStringSecure("polyCustomLayer", toString(mySettings.polyCustomLayer)));
     376           28 :             myCurrentColorer = element;
     377           28 :             break;
     378           32 :         case SUMO_TAG_VIEWSETTINGS_LEGEND:
     379           64 :             mySettings.showSizeLegend = StringUtils::toBool(attrs.getStringSecure("showSizeLegend", toString(mySettings.showSizeLegend)));
     380           64 :             mySettings.showColorLegend = StringUtils::toBool(attrs.getStringSecure("showColorLegend", toString(mySettings.showColorLegend)));
     381           64 :             mySettings.showVehicleColorLegend = StringUtils::toBool(attrs.getStringSecure("showVehicleColorLegend", toString(mySettings.showVehicleColorLegend)));
     382           32 :             break;
     383              :         case SUMO_TAG_VIEWSETTINGS_DECAL: {
     384              :             GUISUMOAbstractView::Decal d;
     385            7 :             if (attrs.hasAttribute(SUMO_ATTR_FILE)) {
     386           12 :                 d.filename = StringUtils::substituteEnvironment(attrs.get<std::string>(SUMO_ATTR_FILE, nullptr, ok));
     387              :             } else {
     388            1 :                 d.filename = attrs.getStringSecure("filename", d.filename);
     389            2 :                 WRITE_WARNING(TL("The 'filename' attribute is deprecated for decals. Please use 'file'."));
     390              :             }
     391            7 :             if (d.filename != "" && !FileHelpers::isAbsolute(d.filename)) {
     392           14 :                 d.filename = FileHelpers::getConfigurationRelative(getFileName(), d.filename);
     393              :             }
     394            7 :             d.centerX = attrs.getOpt<double>(SUMO_ATTR_CENTER_X, nullptr, ok, d.centerX);
     395            7 :             d.centerY = attrs.getOpt<double>(SUMO_ATTR_CENTER_Y, nullptr, ok, d.centerY);
     396            7 :             d.centerZ = attrs.getOpt<double>(SUMO_ATTR_CENTER_Z, nullptr, ok, d.centerZ);
     397            7 :             d.width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, nullptr, ok, d.width);
     398            7 :             d.height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, nullptr, ok, d.height);
     399           14 :             d.altitude = StringUtils::toDouble(attrs.getStringSecure("altitude", "0"));
     400           14 :             d.rot = StringUtils::toDouble(attrs.getStringSecure("rotation", toString(d.rot)));
     401           14 :             d.tilt = StringUtils::toDouble(attrs.getStringSecure("tilt", toString(d.tilt)));
     402           14 :             d.roll = StringUtils::toDouble(attrs.getStringSecure("roll", toString(d.roll)));
     403            7 :             d.layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, nullptr, ok, d.layer);
     404           14 :             d.screenRelative = StringUtils::toBool(attrs.getStringSecure("screenRelative", toString(d.screenRelative)));
     405            7 :             d.initialised = false;
     406            7 :             myDecals.push_back(d);
     407              :         }
     408            7 :         break;
     409              :         case SUMO_TAG_VIEWSETTINGS_LIGHT: {
     410              :             GUISUMOAbstractView::Decal d;
     411            0 :             d.filename = "light" + attrs.getOpt<std::string>(SUMO_ATTR_INDEX, nullptr, ok, "0");
     412            0 :             d.centerX = attrs.getOpt<double>(SUMO_ATTR_CENTER_X, nullptr, ok, d.centerX);
     413            0 :             d.centerY = attrs.getOpt<double>(SUMO_ATTR_CENTER_Y, nullptr, ok, d.centerY);
     414            0 :             d.centerZ = attrs.getOpt<double>(SUMO_ATTR_CENTER_Z, nullptr, ok, d.centerZ);
     415            0 :             d.width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, nullptr, ok, d.width);
     416            0 :             d.height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, nullptr, ok, d.height);
     417            0 :             d.altitude = StringUtils::toDouble(attrs.getStringSecure("altitude", "0"));
     418            0 :             d.rot = StringUtils::toDouble(attrs.getStringSecure("rotation", toString(d.rot)));
     419            0 :             d.tilt = StringUtils::toDouble(attrs.getStringSecure("tilt", toString(d.tilt)));
     420            0 :             d.roll = StringUtils::toDouble(attrs.getStringSecure("roll", toString(d.roll)));
     421            0 :             d.layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, nullptr, ok, d.layer);
     422            0 :             d.initialised = false;
     423            0 :             myDecals.push_back(d);
     424              :         }
     425            0 :         break;
     426            0 :         case SUMO_TAG_VIEWSETTINGS_EVENT: {
     427            0 :             const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
     428            0 :             const std::string cmd = attrs.get<std::string>(SUMO_ATTR_COMMAND, nullptr, ok);
     429            0 :             const double prob = attrs.get<double>(SUMO_ATTR_PROB, id.c_str(), ok);
     430            0 :             myEventDistributions[id].add(cmd, prob);
     431              :         }
     432            0 :         break;
     433            0 :         case SUMO_TAG_VIEWSETTINGS_EVENT_JAM_TIME:
     434            0 :             myJamSoundTime = attrs.get<double>(SUMO_ATTR_VALUE, nullptr, ok);
     435            0 :             break;
     436              :         default:
     437              :             break;
     438              :     }
     439        17306 : }
     440              : 
     441              : void
     442        17306 : GUISettingsHandler::myEndElement(int element) {
     443        17306 :     switch (element) {
     444           32 :         case SUMO_TAG_VIEWSETTINGS_SCHEME: {
     445           32 :             if (mySettings.name != "") {
     446           32 :                 gSchemeStorage.add(mySettings);
     447           32 :                 myLoadedSettingNames.push_back(mySettings.name);
     448              :             }
     449              :         }
     450              :     }
     451        17306 : }
     452              : 
     453              : 
     454              : RGBColor
     455         1188 : GUISettingsHandler::parseColor(const SUMOSAXAttributes& attrs, const std::string attribute, const RGBColor& defaultValue) const {
     456         1188 :     bool ok = true;
     457         2376 :     return RGBColor::parseColorReporting(attrs.getStringSecure(attribute, toString(defaultValue)), attribute.c_str(), nullptr, true, ok);
     458              : }
     459              : 
     460              : 
     461              : GUIVisualizationTextSettings
     462          864 : GUISettingsHandler::parseTextSettings(
     463              :     const std::string& prefix, const SUMOSAXAttributes& attrs,
     464              :     GUIVisualizationTextSettings defaults) {
     465          864 :     bool ok = true;
     466              :     return GUIVisualizationTextSettings(
     467         1728 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_show", toString(defaults.showText))),
     468         1728 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "_size", toString(defaults.size))),
     469         1728 :                RGBColor::parseColorReporting(attrs.getStringSecure(prefix + "_color", toString(defaults.color)), "textSettings", nullptr, true, ok),
     470         1728 :                RGBColor::parseColorReporting(attrs.getStringSecure(prefix + "_bgColor", toString(defaults.bgColor)), "textSettings", nullptr, true, ok),
     471         1728 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_constantSize", toString(defaults.constSize))),
     472         7776 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_onlySelected", toString(defaults.onlySelected))));
     473              : }
     474              : 
     475              : 
     476              : GUIVisualizationSizeSettings
     477          204 : GUISettingsHandler::parseSizeSettings(
     478              :     const std::string& prefix, const SUMOSAXAttributes& attrs,
     479              :     GUIVisualizationSizeSettings defaults) {
     480              :     return GUIVisualizationSizeSettings(
     481          408 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "_minSize", toString(defaults.minSize))),
     482          408 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "_exaggeration", toString(defaults.exaggeration))),
     483          408 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_constantSize", toString(defaults.constantSize))),
     484         1020 :                StringUtils::toBool(attrs.getStringSecure(prefix + "_constantSizeSelected", toString(defaults.constantSizeSelected))));
     485              : }
     486              : 
     487              : GUIVisualizationRainbowSettings
     488           64 : GUISettingsHandler::parseRainbowSettings(
     489              :     const std::string& prefix, const SUMOSAXAttributes& attrs,
     490              :     GUIVisualizationRainbowSettings defaults) {
     491              :     return GUIVisualizationRainbowSettings(
     492          128 :                StringUtils::toBool(attrs.getStringSecure(prefix + "HideCheck", toString(defaults.hideMin))),
     493          128 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "HideThreshold", toString(defaults.minThreshold))),
     494          128 :                StringUtils::toBool(attrs.getStringSecure(prefix + "HideCheck2", toString(defaults.hideMax))),
     495          128 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "HideThreshold2", toString(defaults.maxThreshold))),
     496          128 :                StringUtils::toBool(attrs.getStringSecure(prefix + "SetNeutral", toString(defaults.hideMax))),
     497          128 :                StringUtils::toDouble(attrs.getStringSecure(prefix + "NeutralThreshold", toString(defaults.neutralThreshold))),
     498          512 :                StringUtils::toBool(attrs.getStringSecure(prefix + "FixRange", toString(defaults.fixRange))));
     499              : }
     500              : 
     501              : const std::vector<std::string>&
     502            0 : GUISettingsHandler::addSettings(GUISUMOAbstractView* view) const {
     503            0 :     if (view) {
     504            0 :         for (std::string name : myLoadedSettingNames) {
     505            0 :             FXint index = view->getColoringSchemesCombo()->appendIconItem(name.c_str());
     506            0 :             view->getColoringSchemesCombo()->setCurrentItem(index);
     507            0 :             view->setColorScheme(name);
     508              :         }
     509              :     }
     510            0 :     return myLoadedSettingNames;
     511              : }
     512              : 
     513              : 
     514              : void
     515           35 : GUISettingsHandler::applyViewport(GUISUMOAbstractView* view) const {
     516           35 :     if (myLookFrom.z() > 0 || myZoom > 0) {
     517              :         // z value stores zoom so we must convert first
     518            6 :         double z = (view->is3DView()) ? myLookFrom.z() : view->getChanger().zoom2ZPos(myZoom);
     519            6 :         if (view->is3DView() && !myZCoordSet) { // set view angle to ground to at least 45 degrees if no Z coordinate is given
     520            0 :             z = myLookFrom.distanceTo2D(myLookAt) * sin(PI * 0.25);
     521              :         }
     522              :         Position lookFrom(myLookFrom.x(), myLookFrom.y(), z);
     523            6 :         view->setViewportFromToRot(lookFrom, myLookAt, myRotation);
     524            6 :         if (view->is3DView() && !myZCoordSet) {
     525            0 :             view->recenterView();
     526              :         }
     527              :     }
     528           35 : }
     529              : 
     530              : 
     531              : void
     532           35 : GUISettingsHandler::setSnapshots(GUISUMOAbstractView* view) const {
     533           35 :     if (!mySnapshots.empty()) {
     534            2 :         for (auto item : mySnapshots) {
     535            3 :             for (auto file : item.second) {
     536            2 :                 view->addSnapshot(item.first, file);
     537              :             }
     538              :         }
     539              :     }
     540           35 : }
     541              : 
     542              : 
     543              : bool
     544            0 : GUISettingsHandler::hasDecals() const {
     545            0 :     return !myDecals.empty();
     546              : }
     547              : 
     548              : 
     549              : const std::vector<GUISUMOAbstractView::Decal>&
     550           35 : GUISettingsHandler::getDecals() const {
     551           35 :     return myDecals;
     552              : }
     553              : 
     554              : 
     555              : double
     556           40 : GUISettingsHandler::getDelay() const {
     557           40 :     return myDelay;
     558              : }
     559              : 
     560              : 
     561              : std::vector<SUMOTime>
     562            0 : GUISettingsHandler::loadBreakpoints(const std::string& file) {
     563              :     std::vector<SUMOTime> result;
     564            0 :     std::ifstream strm(file.c_str());
     565            0 :     if (!strm.good()) {
     566            0 :         WRITE_ERRORF(TL("Could not open '%'."), file);
     567            0 :         return result;
     568              :     }
     569            0 :     while (strm.good()) {
     570              :         std::string val;
     571            0 :         strm >> val;
     572            0 :         if (val.length() == 0) {
     573              :             continue;
     574              :         }
     575              :         try {
     576            0 :             SUMOTime value = string2time(val);
     577            0 :             result.push_back(value);
     578            0 :         } catch (NumberFormatException& e) {
     579            0 :             WRITE_ERRORF(TL("A breakpoint value must be a time description (%)."), toString(e.what()));
     580            0 :         } catch (EmptyData&) {
     581            0 :         } catch (ProcessError&) {
     582            0 :             WRITE_ERRORF(TL("Could not decode breakpoint '%'."), val);
     583            0 :         }
     584              :     }
     585              :     return result;
     586            0 : }
     587              : 
     588              : 
     589              : RandomDistributor<std::string>
     590           70 : GUISettingsHandler::getEventDistribution(const std::string& id) {
     591           70 :     RandomDistributor<std::string> result = myEventDistributions[id];
     592           70 :     if (result.getOverallProb() > 0 && result.getOverallProb() < 1) {
     593              :         // unscaled probabilities are assumed, fill up with dummy event
     594            0 :         result.add("", 1. - result.getOverallProb());
     595              :     }
     596           70 :     return result;
     597              : }
     598              : 
     599              : 
     600              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1