LCOV - code coverage report
Current view: top level - src/utils/gui/settings - GUISettingsHandler.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 81.8 % 433 354
Test Date: 2025-11-13 15:38:19 Functions: 76.5 % 17 13

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

Generated by: LCOV version 2.0-1