LCOV - code coverage report
Current view: top level - src/utils/handlers - AdditionalHandler.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 1060 0
Test Date: 2024-11-23 15:47:30 Functions: 0.0 % 47 0

            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    AdditionalHandler.cpp
      15              : /// @author  Pablo Alvarez Lopez
      16              : /// @date    Jun 2021
      17              : ///
      18              : // The XML-Handler for additionals loading
      19              : /****************************************************************************/
      20              : #include <config.h>
      21              : 
      22              : #include <utils/common/MsgHandler.h>
      23              : #include <utils/xml/SUMOSAXHandler.h>
      24              : #include <utils/shapes/Shape.h>
      25              : #include <utils/shapes/PointOfInterest.h>
      26              : #include <utils/options/OptionsCont.h>
      27              : #include <utils/vehicle/SUMOVehicleParserHelper.h>
      28              : #include <utils/xml/SUMOXMLDefinitions.h>
      29              : 
      30              : #include "AdditionalHandler.h"
      31              : 
      32              : 
      33              : // ===========================================================================
      34              : // method definitions
      35              : // ===========================================================================
      36              : 
      37            0 : AdditionalHandler::AdditionalHandler() {}
      38              : 
      39              : 
      40            0 : AdditionalHandler::~AdditionalHandler() {}
      41              : 
      42              : 
      43              : bool
      44            0 : AdditionalHandler::beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes& attrs) {
      45              :     // open SUMOBaseOBject
      46            0 :     myCommonXMLStructure.openSUMOBaseOBject();
      47              :     // check tag
      48              :     try {
      49            0 :         switch (tag) {
      50              :             // Stopping Places
      51            0 :             case SUMO_TAG_BUS_STOP:
      52            0 :                 parseBusStopAttributes(attrs);
      53              :                 break;
      54            0 :             case SUMO_TAG_TRAIN_STOP:
      55            0 :                 parseTrainStopAttributes(attrs);
      56              :                 break;
      57            0 :             case SUMO_TAG_ACCESS:
      58            0 :                 parseAccessAttributes(attrs);
      59              :                 break;
      60            0 :             case SUMO_TAG_CONTAINER_STOP:
      61            0 :                 parseContainerStopAttributes(attrs);
      62              :                 break;
      63            0 :             case SUMO_TAG_CHARGING_STATION:
      64            0 :                 parseChargingStationAttributes(attrs);
      65              :                 break;
      66            0 :             case SUMO_TAG_PARKING_AREA:
      67            0 :                 parseParkingAreaAttributes(attrs);
      68              :                 break;
      69            0 :             case SUMO_TAG_PARKING_SPACE:
      70            0 :                 parseParkingSpaceAttributes(attrs);
      71              :                 break;
      72              :             // Detectors
      73            0 :             case SUMO_TAG_E1DETECTOR:
      74              :             case SUMO_TAG_INDUCTION_LOOP:
      75            0 :                 parseE1Attributes(attrs);
      76              :                 break;
      77            0 :             case SUMO_TAG_E2DETECTOR:
      78              :             case SUMO_TAG_LANE_AREA_DETECTOR:
      79            0 :                 parseE2Attributes(attrs);
      80              :                 break;
      81            0 :             case SUMO_TAG_E3DETECTOR:
      82              :             case SUMO_TAG_ENTRY_EXIT_DETECTOR:
      83            0 :                 parseE3Attributes(attrs);
      84              :                 break;
      85            0 :             case SUMO_TAG_DET_ENTRY:
      86            0 :                 parseEntryAttributes(attrs);
      87              :                 break;
      88            0 :             case SUMO_TAG_DET_EXIT:
      89            0 :                 parseExitAttributes(attrs);
      90              :                 break;
      91            0 :             case SUMO_TAG_INSTANT_INDUCTION_LOOP:
      92            0 :                 parseE1InstantAttributes(attrs);
      93              :                 break;
      94              :             // TAZs
      95            0 :             case SUMO_TAG_TAZ:
      96            0 :                 parseTAZAttributes(attrs);
      97              :                 break;
      98            0 :             case SUMO_TAG_TAZSOURCE:
      99            0 :                 parseTAZSourceAttributes(attrs);
     100              :                 break;
     101            0 :             case SUMO_TAG_TAZSINK:
     102            0 :                 parseTAZSinkAttributes(attrs);
     103              :                 break;
     104              :             // Variable Speed Sign
     105            0 :             case SUMO_TAG_VSS:
     106            0 :                 parseVariableSpeedSignAttributes(attrs);
     107              :                 break;
     108            0 :             case SUMO_TAG_STEP:
     109            0 :                 parseVariableSpeedSignStepAttributes(attrs);
     110              :                 break;
     111              :             // Calibrator
     112            0 :             case SUMO_TAG_CALIBRATOR:
     113              :             case GNE_TAG_CALIBRATOR_LANE:
     114            0 :                 parseCalibratorAttributes(attrs);
     115              :                 break;
     116              :             // flow (calibrator)
     117            0 :             case SUMO_TAG_FLOW:
     118            0 :                 parseCalibratorFlowAttributes(attrs);
     119              :                 break;
     120              :             // Rerouter
     121            0 :             case SUMO_TAG_REROUTER:
     122            0 :                 parseRerouterAttributes(attrs);
     123              :                 break;
     124            0 :             case SUMO_TAG_INTERVAL:
     125            0 :                 parseRerouterIntervalAttributes(attrs);
     126              :                 break;
     127            0 :             case SUMO_TAG_CLOSING_LANE_REROUTE:
     128            0 :                 parseClosingLaneRerouteAttributes(attrs);
     129              :                 break;
     130            0 :             case SUMO_TAG_CLOSING_REROUTE:
     131            0 :                 parseClosingRerouteAttributes(attrs);
     132              :                 break;
     133            0 :             case SUMO_TAG_DEST_PROB_REROUTE:
     134            0 :                 parseDestProbRerouteAttributes(attrs);
     135              :                 break;
     136            0 :             case SUMO_TAG_PARKING_AREA_REROUTE:
     137            0 :                 parseParkingAreaRerouteAttributes(attrs);
     138              :                 break;
     139            0 :             case SUMO_TAG_ROUTE_PROB_REROUTE:
     140            0 :                 parseRouteProbRerouteAttributes(attrs);
     141              :                 break;
     142              :             // Route probe
     143            0 :             case SUMO_TAG_ROUTEPROBE:
     144            0 :                 parseRouteProbeAttributes(attrs);
     145              :                 break;
     146              :             // Vaporizer (deprecated)
     147            0 :             case SUMO_TAG_VAPORIZER:
     148            0 :                 parseVaporizerAttributes(attrs);
     149              :                 break;
     150              :             // wires
     151            0 :             case SUMO_TAG_TRACTION_SUBSTATION:
     152            0 :                 parseTractionSubstation(attrs);
     153              :                 break;
     154            0 :             case SUMO_TAG_OVERHEAD_WIRE_CLAMP:
     155            0 :                 parseOverheadWireClamp(attrs);
     156              :                 break;
     157            0 :             case SUMO_TAG_OVERHEAD_WIRE_SECTION:
     158            0 :                 parseOverheadWire(attrs);
     159              :                 break;
     160              :             // Poly
     161            0 :             case SUMO_TAG_POLY:
     162            0 :                 parsePolyAttributes(attrs);
     163              :                 break;
     164            0 :             case SUMO_TAG_POI:
     165            0 :                 parsePOIAttributes(attrs);
     166              :                 break;
     167              :             // JuPedSim
     168            0 :             case GNE_TAG_JPS_WALKABLEAREA:
     169            0 :                 parseJpsWalkableAreaAttributes(attrs);
     170              :                 break;
     171            0 :             case GNE_TAG_JPS_OBSTACLE:
     172            0 :                 parseJpsObstacleAttributes(attrs);
     173              :                 break;
     174              :             // parameters
     175            0 :             case SUMO_TAG_PARAM:
     176            0 :                 parseParameters(attrs);
     177              :                 break;
     178            0 :             default:
     179              :                 // tag cannot be parsed in AdditionalHandler
     180            0 :                 myCommonXMLStructure.abortSUMOBaseOBject();
     181              :                 return false;
     182              :         }
     183            0 :     } catch (InvalidArgument& e) {
     184            0 :         writeError(e.what());
     185            0 :     }
     186              :     return true;
     187              : }
     188              : 
     189              : 
     190              : void
     191            0 : AdditionalHandler::endParseAttributes() {
     192              :     // get last inserted object
     193            0 :     CommonXMLStructure::SumoBaseObject* obj = myCommonXMLStructure.getCurrentSumoBaseObject();
     194            0 :     if (obj) {
     195              :         // close SUMOBaseOBject
     196            0 :         myCommonXMLStructure.closeSUMOBaseOBject();
     197              :         // check tag
     198            0 :         switch (obj->getTag()) {
     199              :             // Stopping Places
     200            0 :             case SUMO_TAG_BUS_STOP:
     201              :             case SUMO_TAG_TRAIN_STOP:
     202              :             case SUMO_TAG_CONTAINER_STOP:
     203              :             case SUMO_TAG_CHARGING_STATION:
     204              :             case SUMO_TAG_PARKING_AREA:
     205              :             // detectors
     206              :             case SUMO_TAG_E1DETECTOR:
     207              :             case SUMO_TAG_INDUCTION_LOOP:
     208              :             case SUMO_TAG_E2DETECTOR:
     209              :             case SUMO_TAG_LANE_AREA_DETECTOR:
     210              :             case SUMO_TAG_E3DETECTOR:
     211              :             case SUMO_TAG_ENTRY_EXIT_DETECTOR:
     212              :             case SUMO_TAG_INSTANT_INDUCTION_LOOP:
     213              :             // TAZs
     214              :             case SUMO_TAG_TAZ:
     215              :             // Variable Speed Sign
     216              :             case SUMO_TAG_VSS:
     217              :             // Calibrator
     218              :             case SUMO_TAG_CALIBRATOR:
     219              :             case GNE_TAG_CALIBRATOR_LANE:
     220              :             // Rerouter
     221              :             case SUMO_TAG_REROUTER:
     222              :             // Route probe
     223              :             case SUMO_TAG_ROUTEPROBE:
     224              :             // Vaporizer (deprecated)
     225              :             case SUMO_TAG_VAPORIZER:
     226              :             // wires
     227              :             case SUMO_TAG_TRACTION_SUBSTATION:
     228              :             case SUMO_TAG_OVERHEAD_WIRE_SECTION:
     229              :             case SUMO_TAG_OVERHEAD_WIRE_CLAMP:
     230              :             // Shapes
     231              :             case SUMO_TAG_POLY:
     232              :             case SUMO_TAG_POI:
     233              :             // JuPedSim
     234              :             case GNE_TAG_JPS_WALKABLEAREA:
     235              :             case GNE_TAG_JPS_OBSTACLE:
     236              :                 // parse object and all their childrens
     237            0 :                 parseSumoBaseObject(obj);
     238              :                 // delete object (and all of their childrens)
     239            0 :                 delete obj;
     240              :                 break;
     241              :             default:
     242              :                 break;
     243              :         }
     244              :     }
     245            0 : }
     246              : 
     247              : 
     248              : void
     249            0 : AdditionalHandler::parseSumoBaseObject(CommonXMLStructure::SumoBaseObject* obj) {
     250              :     // switch tag
     251            0 :     switch (obj->getTag()) {
     252              :         // Stopping Places
     253            0 :         case SUMO_TAG_BUS_STOP:
     254            0 :             buildBusStop(obj,
     255              :                          obj->getStringAttribute(SUMO_ATTR_ID),
     256              :                          obj->getStringAttribute(SUMO_ATTR_LANE),
     257              :                          obj->getDoubleAttribute(SUMO_ATTR_STARTPOS),
     258              :                          obj->getDoubleAttribute(SUMO_ATTR_ENDPOS),
     259              :                          obj->getStringAttribute(SUMO_ATTR_NAME),
     260              :                          obj->getStringListAttribute(SUMO_ATTR_LINES),
     261              :                          obj->getIntAttribute(SUMO_ATTR_PERSON_CAPACITY),
     262              :                          obj->getDoubleAttribute(SUMO_ATTR_PARKING_LENGTH),
     263              :                          obj->getColorAttribute(SUMO_ATTR_COLOR),
     264            0 :                          obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     265            0 :                          obj->getParameters());
     266            0 :             break;
     267            0 :         case SUMO_TAG_TRAIN_STOP:
     268            0 :             buildTrainStop(obj,
     269              :                            obj->getStringAttribute(SUMO_ATTR_ID),
     270              :                            obj->getStringAttribute(SUMO_ATTR_LANE),
     271              :                            obj->getDoubleAttribute(SUMO_ATTR_STARTPOS),
     272              :                            obj->getDoubleAttribute(SUMO_ATTR_ENDPOS),
     273              :                            obj->getStringAttribute(SUMO_ATTR_NAME),
     274              :                            obj->getStringListAttribute(SUMO_ATTR_LINES),
     275              :                            obj->getIntAttribute(SUMO_ATTR_PERSON_CAPACITY),
     276              :                            obj->getDoubleAttribute(SUMO_ATTR_PARKING_LENGTH),
     277              :                            obj->getColorAttribute(SUMO_ATTR_COLOR),
     278            0 :                            obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     279            0 :                            obj->getParameters());
     280            0 :             break;
     281            0 :         case SUMO_TAG_ACCESS:
     282            0 :             buildAccess(obj,
     283              :                         obj->getStringAttribute(SUMO_ATTR_LANE),
     284              :                         obj->getStringAttribute(SUMO_ATTR_POSITION),
     285              :                         obj->getDoubleAttribute(SUMO_ATTR_LENGTH),
     286            0 :                         obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     287            0 :                         obj->getParameters());
     288            0 :             break;
     289            0 :         case SUMO_TAG_CONTAINER_STOP:
     290            0 :             buildContainerStop(obj,
     291              :                                obj->getStringAttribute(SUMO_ATTR_ID),
     292              :                                obj->getStringAttribute(SUMO_ATTR_LANE),
     293              :                                obj->getDoubleAttribute(SUMO_ATTR_STARTPOS),
     294              :                                obj->getDoubleAttribute(SUMO_ATTR_ENDPOS),
     295              :                                obj->getStringAttribute(SUMO_ATTR_NAME),
     296              :                                obj->getStringListAttribute(SUMO_ATTR_LINES),
     297              :                                obj->getIntAttribute(SUMO_ATTR_CONTAINER_CAPACITY),
     298              :                                obj->getDoubleAttribute(SUMO_ATTR_PARKING_LENGTH),
     299              :                                obj->getColorAttribute(SUMO_ATTR_COLOR),
     300            0 :                                obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     301            0 :                                obj->getParameters());
     302            0 :             break;
     303            0 :         case SUMO_TAG_CHARGING_STATION:
     304            0 :             buildChargingStation(obj,
     305              :                                  obj->getStringAttribute(SUMO_ATTR_ID),
     306              :                                  obj->getStringAttribute(SUMO_ATTR_LANE),
     307              :                                  obj->getDoubleAttribute(SUMO_ATTR_STARTPOS),
     308              :                                  obj->getDoubleAttribute(SUMO_ATTR_ENDPOS),
     309              :                                  obj->getStringAttribute(SUMO_ATTR_NAME),
     310              :                                  obj->getDoubleAttribute(SUMO_ATTR_CHARGINGPOWER),
     311              :                                  obj->getDoubleAttribute(SUMO_ATTR_EFFICIENCY),
     312            0 :                                  obj->getBoolAttribute(SUMO_ATTR_CHARGEINTRANSIT),
     313              :                                  obj->getTimeAttribute(SUMO_ATTR_CHARGEDELAY),
     314              :                                  obj->getStringAttribute(SUMO_ATTR_CHARGETYPE),
     315              :                                  obj->getTimeAttribute(SUMO_ATTR_WAITINGTIME),
     316            0 :                                  obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     317              :                                  obj->getStringAttribute(SUMO_ATTR_PARKING_AREA),
     318            0 :                                  obj->getParameters());
     319            0 :             break;
     320            0 :         case SUMO_TAG_PARKING_AREA:
     321            0 :             buildParkingArea(obj,
     322              :                              obj->getStringAttribute(SUMO_ATTR_ID),
     323              :                              obj->getStringAttribute(SUMO_ATTR_LANE),
     324              :                              obj->getDoubleAttribute(SUMO_ATTR_STARTPOS),
     325              :                              obj->getDoubleAttribute(SUMO_ATTR_ENDPOS),
     326              :                              obj->getStringAttribute(SUMO_ATTR_DEPARTPOS),
     327              :                              obj->getStringAttribute(SUMO_ATTR_NAME),
     328              :                              obj->getStringListAttribute(SUMO_ATTR_ACCEPTED_BADGES),
     329            0 :                              obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     330              :                              obj->getIntAttribute(SUMO_ATTR_ROADSIDE_CAPACITY),
     331            0 :                              obj->getBoolAttribute(SUMO_ATTR_ONROAD),
     332              :                              obj->getDoubleAttribute(SUMO_ATTR_WIDTH),
     333              :                              obj->getDoubleAttribute(SUMO_ATTR_LENGTH),
     334              :                              obj->getDoubleAttribute(SUMO_ATTR_ANGLE),
     335            0 :                              obj->getBoolAttribute(SUMO_ATTR_LEFTHAND),
     336            0 :                              obj->getParameters());
     337            0 :             break;
     338            0 :         case SUMO_TAG_PARKING_SPACE:
     339            0 :             buildParkingSpace(obj,
     340              :                               obj->getDoubleAttribute(SUMO_ATTR_X),
     341              :                               obj->getDoubleAttribute(SUMO_ATTR_Y),
     342              :                               obj->getDoubleAttribute(SUMO_ATTR_Z),
     343              :                               obj->getStringAttribute(SUMO_ATTR_NAME),
     344              :                               obj->getStringAttribute(SUMO_ATTR_WIDTH),
     345              :                               obj->getStringAttribute(SUMO_ATTR_LENGTH),
     346              :                               obj->getStringAttribute(SUMO_ATTR_ANGLE),
     347              :                               obj->getDoubleAttribute(SUMO_ATTR_SLOPE),
     348            0 :                               obj->getParameters());
     349            0 :             break;
     350              :         // Detectors
     351            0 :         case SUMO_TAG_E1DETECTOR:
     352              :         case SUMO_TAG_INDUCTION_LOOP:
     353              :             // build E1
     354            0 :             buildE1Detector(obj,
     355              :                             obj->getStringAttribute(SUMO_ATTR_ID),
     356              :                             obj->getStringAttribute(SUMO_ATTR_LANE),
     357              :                             obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     358              :                             obj->getPeriodAttribute(),
     359              :                             obj->getStringAttribute(SUMO_ATTR_FILE),
     360              :                             obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     361              :                             obj->getStringListAttribute(SUMO_ATTR_NEXT_EDGES),
     362              :                             obj->getStringAttribute(SUMO_ATTR_DETECT_PERSONS),
     363              :                             obj->getStringAttribute(SUMO_ATTR_NAME),
     364            0 :                             obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     365            0 :                             obj->getParameters());
     366            0 :             break;
     367            0 :         case SUMO_TAG_E2DETECTOR:
     368              :         case SUMO_TAG_LANE_AREA_DETECTOR:
     369            0 :             if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
     370            0 :                 buildSingleLaneDetectorE2(obj,
     371              :                                           obj->getStringAttribute(SUMO_ATTR_ID),
     372              :                                           obj->getStringAttribute(SUMO_ATTR_LANE),
     373              :                                           obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     374              :                                           obj->getDoubleAttribute(SUMO_ATTR_LENGTH),
     375              :                                           obj->getPeriodAttribute(),
     376              :                                           obj->getStringAttribute(SUMO_ATTR_TLID),
     377              :                                           obj->getStringAttribute(SUMO_ATTR_FILE),
     378              :                                           obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     379              :                                           obj->getStringListAttribute(SUMO_ATTR_NEXT_EDGES),
     380              :                                           obj->getStringAttribute(SUMO_ATTR_DETECT_PERSONS),
     381              :                                           obj->getStringAttribute(SUMO_ATTR_NAME),
     382              :                                           obj->getTimeAttribute(SUMO_ATTR_HALTING_TIME_THRESHOLD),
     383              :                                           obj->getDoubleAttribute(SUMO_ATTR_HALTING_SPEED_THRESHOLD),
     384              :                                           obj->getDoubleAttribute(SUMO_ATTR_JAM_DIST_THRESHOLD),
     385            0 :                                           obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     386            0 :                                           obj->getBoolAttribute(SUMO_ATTR_SHOW_DETECTOR),
     387            0 :                                           obj->getParameters());
     388              :             } else {
     389            0 :                 buildMultiLaneDetectorE2(obj,
     390              :                                          obj->getStringAttribute(SUMO_ATTR_ID),
     391              :                                          obj->getStringListAttribute(SUMO_ATTR_LANES),
     392              :                                          obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     393              :                                          obj->getDoubleAttribute(SUMO_ATTR_ENDPOS),
     394              :                                          obj->getPeriodAttribute(),
     395              :                                          obj->getStringAttribute(SUMO_ATTR_TLID),
     396              :                                          obj->getStringAttribute(SUMO_ATTR_FILE),
     397              :                                          obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     398              :                                          obj->getStringListAttribute(SUMO_ATTR_NEXT_EDGES),
     399              :                                          obj->getStringAttribute(SUMO_ATTR_DETECT_PERSONS),
     400              :                                          obj->getStringAttribute(SUMO_ATTR_NAME),
     401              :                                          obj->getTimeAttribute(SUMO_ATTR_HALTING_TIME_THRESHOLD),
     402              :                                          obj->getDoubleAttribute(SUMO_ATTR_HALTING_SPEED_THRESHOLD),
     403              :                                          obj->getDoubleAttribute(SUMO_ATTR_JAM_DIST_THRESHOLD),
     404            0 :                                          obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     405            0 :                                          obj->getBoolAttribute(SUMO_ATTR_SHOW_DETECTOR),
     406            0 :                                          obj->getParameters());
     407              :             }
     408              :             break;
     409            0 :         case SUMO_TAG_E3DETECTOR:
     410              :         case SUMO_TAG_ENTRY_EXIT_DETECTOR:
     411            0 :             buildDetectorE3(obj,
     412              :                             obj->getStringAttribute(SUMO_ATTR_ID),
     413              :                             obj->getPositionAttribute(SUMO_ATTR_POSITION),
     414              :                             obj->getPeriodAttribute(),
     415              :                             obj->getStringAttribute(SUMO_ATTR_FILE),
     416              :                             obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     417              :                             obj->getStringListAttribute(SUMO_ATTR_NEXT_EDGES),
     418              :                             obj->getStringAttribute(SUMO_ATTR_DETECT_PERSONS),
     419              :                             obj->getStringAttribute(SUMO_ATTR_NAME),
     420              :                             obj->getTimeAttribute(SUMO_ATTR_HALTING_TIME_THRESHOLD),
     421              :                             obj->getDoubleAttribute(SUMO_ATTR_HALTING_SPEED_THRESHOLD),
     422            0 :                             obj->getBoolAttribute(SUMO_ATTR_OPEN_ENTRY),
     423            0 :                             obj->getBoolAttribute(SUMO_ATTR_EXPECT_ARRIVAL),
     424            0 :                             obj->getParameters());
     425            0 :             break;
     426            0 :         case SUMO_TAG_DET_ENTRY:
     427            0 :             buildDetectorEntry(obj,
     428              :                                obj->getStringAttribute(SUMO_ATTR_LANE),
     429              :                                obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     430            0 :                                obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     431            0 :                                obj->getParameters());
     432            0 :             break;
     433            0 :         case SUMO_TAG_DET_EXIT:
     434            0 :             buildDetectorExit(obj,
     435              :                               obj->getStringAttribute(SUMO_ATTR_LANE),
     436              :                               obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     437            0 :                               obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     438            0 :                               obj->getParameters());
     439            0 :             break;
     440            0 :         case SUMO_TAG_INSTANT_INDUCTION_LOOP:
     441            0 :             buildDetectorE1Instant(obj,
     442              :                                    obj->getStringAttribute(SUMO_ATTR_ID),
     443              :                                    obj->getStringAttribute(SUMO_ATTR_LANE),
     444              :                                    obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     445              :                                    obj->getStringAttribute(SUMO_ATTR_FILE),
     446              :                                    obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     447              :                                    obj->getStringListAttribute(SUMO_ATTR_NEXT_EDGES),
     448              :                                    obj->getStringAttribute(SUMO_ATTR_DETECT_PERSONS),
     449              :                                    obj->getStringAttribute(SUMO_ATTR_NAME),
     450            0 :                                    obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     451            0 :                                    obj->getParameters());
     452            0 :             break;
     453              :         // TAZs
     454            0 :         case SUMO_TAG_TAZ:
     455            0 :             buildTAZ(obj,
     456              :                      obj->getStringAttribute(SUMO_ATTR_ID),
     457              :                      obj->getPositionVectorAttribute(SUMO_ATTR_SHAPE),
     458              :                      obj->getPositionAttribute(SUMO_ATTR_CENTER),
     459            0 :                      obj->getBoolAttribute(SUMO_ATTR_FILL),
     460              :                      obj->getColorAttribute(SUMO_ATTR_COLOR),
     461              :                      obj->getStringListAttribute(SUMO_ATTR_EDGES),
     462              :                      obj->getStringAttribute(SUMO_ATTR_NAME),
     463            0 :                      obj->getParameters());
     464            0 :             break;
     465            0 :         case SUMO_TAG_TAZSOURCE:
     466            0 :             buildTAZSource(obj,
     467              :                            obj->getStringAttribute(SUMO_ATTR_ID),
     468              :                            obj->getDoubleAttribute(SUMO_ATTR_WEIGHT));
     469            0 :             break;
     470            0 :         case SUMO_TAG_TAZSINK:
     471            0 :             buildTAZSink(obj,
     472              :                          obj->getStringAttribute(SUMO_ATTR_ID),
     473              :                          obj->getDoubleAttribute(SUMO_ATTR_WEIGHT));
     474            0 :             break;
     475              :         // Variable Speed Sign
     476            0 :         case SUMO_TAG_VSS:
     477            0 :             buildVariableSpeedSign(obj,
     478              :                                    obj->getStringAttribute(SUMO_ATTR_ID),
     479              :                                    obj->getPositionAttribute(SUMO_ATTR_POSITION),
     480              :                                    obj->getStringListAttribute(SUMO_ATTR_LANES),
     481              :                                    obj->getStringAttribute(SUMO_ATTR_NAME),
     482              :                                    obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     483            0 :                                    obj->getParameters());
     484            0 :             break;
     485            0 :         case SUMO_TAG_STEP:
     486            0 :             buildVariableSpeedSignStep(obj,
     487              :                                        obj->getTimeAttribute(SUMO_ATTR_TIME),
     488              :                                        obj->getStringAttribute(SUMO_ATTR_SPEED));
     489            0 :             break;
     490              :         // Calibrator
     491            0 :         case SUMO_TAG_CALIBRATOR:
     492            0 :             buildEdgeCalibrator(obj,
     493              :                                 obj->getStringAttribute(SUMO_ATTR_ID),
     494              :                                 obj->getStringAttribute(SUMO_ATTR_EDGE),
     495              :                                 obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     496              :                                 obj->getStringAttribute(SUMO_ATTR_NAME),
     497              :                                 obj->getStringAttribute(SUMO_ATTR_OUTPUT),
     498              :                                 obj->getPeriodAttribute(),
     499              :                                 obj->getStringAttribute(SUMO_ATTR_ROUTEPROBE),
     500              :                                 obj->getDoubleAttribute(SUMO_ATTR_JAM_DIST_THRESHOLD),
     501              :                                 obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     502            0 :                                 obj->getParameters());
     503            0 :             break;
     504            0 :         case GNE_TAG_CALIBRATOR_LANE:
     505            0 :             buildLaneCalibrator(obj,
     506              :                                 obj->getStringAttribute(SUMO_ATTR_ID),
     507              :                                 obj->getStringAttribute(SUMO_ATTR_LANE),
     508              :                                 obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     509              :                                 obj->getStringAttribute(SUMO_ATTR_NAME),
     510              :                                 obj->getStringAttribute(SUMO_ATTR_OUTPUT),
     511              :                                 obj->getPeriodAttribute(),
     512              :                                 obj->getStringAttribute(SUMO_ATTR_ROUTEPROBE),
     513              :                                 obj->getDoubleAttribute(SUMO_ATTR_JAM_DIST_THRESHOLD),
     514              :                                 obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     515            0 :                                 obj->getParameters());
     516            0 :             break;
     517            0 :         case SUMO_TAG_FLOW:
     518            0 :             buildCalibratorFlow(obj,
     519              :                                 obj->getVehicleParameter());
     520            0 :             break;
     521              :         // Rerouter
     522            0 :         case SUMO_TAG_REROUTER:
     523            0 :             buildRerouter(obj,
     524              :                           obj->getStringAttribute(SUMO_ATTR_ID),
     525              :                           obj->getPositionAttribute(SUMO_ATTR_POSITION),
     526              :                           obj->getStringListAttribute(SUMO_ATTR_EDGES),
     527              :                           obj->getDoubleAttribute(SUMO_ATTR_PROB),
     528              :                           obj->getStringAttribute(SUMO_ATTR_NAME),
     529            0 :                           obj->getBoolAttribute(SUMO_ATTR_OFF),
     530            0 :                           obj->getBoolAttribute(SUMO_ATTR_OPTIONAL),
     531              :                           obj->getTimeAttribute(SUMO_ATTR_HALTING_TIME_THRESHOLD),
     532              :                           obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     533            0 :                           obj->getParameters());
     534            0 :             break;
     535            0 :         case SUMO_TAG_CLOSING_LANE_REROUTE:
     536            0 :             buildClosingLaneReroute(obj,
     537              :                                     obj->getStringAttribute(SUMO_ATTR_ID),
     538              :                                     parseVehicleClasses(obj->getStringAttribute(SUMO_ATTR_ALLOW), obj->getStringAttribute(SUMO_ATTR_DISALLOW)));
     539            0 :             break;
     540            0 :         case SUMO_TAG_CLOSING_REROUTE:
     541            0 :             buildClosingReroute(obj,
     542              :                                 obj->getStringAttribute(SUMO_ATTR_ID),
     543              :                                 parseVehicleClasses(obj->getStringAttribute(SUMO_ATTR_ALLOW), obj->getStringAttribute(SUMO_ATTR_DISALLOW)));
     544            0 :             break;
     545            0 :         case SUMO_TAG_DEST_PROB_REROUTE:
     546            0 :             buildDestProbReroute(obj,
     547              :                                  obj->getStringAttribute(SUMO_ATTR_ID),
     548              :                                  obj->getDoubleAttribute(SUMO_ATTR_PROB));
     549            0 :             break;
     550            0 :         case SUMO_TAG_PARKING_AREA_REROUTE:
     551            0 :             buildParkingAreaReroute(obj,
     552              :                                     obj->getStringAttribute(SUMO_ATTR_ID),
     553              :                                     obj->getDoubleAttribute(SUMO_ATTR_PROB),
     554            0 :                                     obj->getBoolAttribute(SUMO_ATTR_VISIBLE));
     555            0 :             break;
     556            0 :         case SUMO_TAG_ROUTE_PROB_REROUTE:
     557            0 :             buildRouteProbReroute(obj,
     558              :                                   obj->getStringAttribute(SUMO_ATTR_ID),
     559              :                                   obj->getDoubleAttribute(SUMO_ATTR_PROB));
     560            0 :             break;
     561            0 :         case SUMO_TAG_INTERVAL:
     562              :             // check if is VSS or a REROUTER interval
     563            0 :             if (obj->getParentSumoBaseObject()->getTag() == SUMO_TAG_REROUTER) {
     564            0 :                 buildRerouterInterval(obj,
     565              :                                       obj->getTimeAttribute(SUMO_ATTR_BEGIN),
     566              :                                       obj->getTimeAttribute(SUMO_ATTR_END));
     567              :             } else {
     568            0 :                 buildVariableSpeedSignStep(obj,
     569              :                                            obj->getTimeAttribute(SUMO_ATTR_TIME),
     570              :                                            obj->getStringAttribute(SUMO_ATTR_SPEED));
     571              :             }
     572              :             break;
     573              :         // Route probe
     574            0 :         case SUMO_TAG_ROUTEPROBE:
     575            0 :             buildRouteProbe(obj,
     576              :                             obj->getStringAttribute(SUMO_ATTR_ID),
     577              :                             obj->getStringAttribute(SUMO_ATTR_EDGE),
     578              :                             obj->getPeriodAttribute(),
     579              :                             obj->getStringAttribute(SUMO_ATTR_NAME),
     580              :                             obj->getStringAttribute(SUMO_ATTR_FILE),
     581              :                             obj->getTimeAttribute(SUMO_ATTR_BEGIN),
     582              :                             obj->getStringListAttribute(SUMO_ATTR_VTYPES),
     583            0 :                             obj->getParameters());
     584            0 :             break;
     585              :         // Vaporizer (deprecated)
     586            0 :         case SUMO_TAG_VAPORIZER:
     587            0 :             buildVaporizer(obj,
     588              :                            obj->getStringAttribute(SUMO_ATTR_ID),
     589              :                            obj->getTimeAttribute(SUMO_ATTR_BEGIN),
     590              :                            obj->getTimeAttribute(SUMO_ATTR_END),
     591              :                            obj->getStringAttribute(SUMO_ATTR_NAME),
     592            0 :                            obj->getParameters());
     593            0 :             break;
     594              :         // wire elements
     595            0 :         case SUMO_TAG_TRACTION_SUBSTATION:
     596            0 :             buildTractionSubstation(obj,
     597              :                                     obj->getStringAttribute(SUMO_ATTR_ID),
     598              :                                     obj->getPositionAttribute(SUMO_ATTR_POSITION),
     599              :                                     obj->getDoubleAttribute(SUMO_ATTR_VOLTAGE),
     600              :                                     obj->getDoubleAttribute(SUMO_ATTR_CURRENTLIMIT),
     601            0 :                                     obj->getParameters());
     602            0 :             break;
     603            0 :         case SUMO_TAG_OVERHEAD_WIRE_SECTION:
     604            0 :             buildOverheadWire(obj,
     605              :                               obj->getStringAttribute(SUMO_ATTR_ID),
     606              :                               obj->getStringAttribute(SUMO_ATTR_SUBSTATIONID),
     607              :                               obj->getStringListAttribute(SUMO_ATTR_LANES),
     608              :                               obj->getDoubleAttribute(SUMO_ATTR_STARTPOS),
     609              :                               obj->getDoubleAttribute(SUMO_ATTR_ENDPOS),
     610            0 :                               obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     611              :                               obj->getStringListAttribute(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN),
     612            0 :                               obj->getParameters());
     613            0 :             break;
     614            0 :         case SUMO_TAG_OVERHEAD_WIRE_CLAMP:
     615            0 :             buildOverheadWireClamp(obj,
     616              :                                    obj->getStringAttribute(SUMO_ATTR_ID),
     617              :                                    obj->getStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_START),
     618              :                                    obj->getStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART),
     619              :                                    obj->getStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_END),
     620              :                                    obj->getStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND),
     621            0 :                                    obj->getParameters());
     622            0 :             break;
     623              :         // Polygon
     624            0 :         case SUMO_TAG_POLY:
     625            0 :             buildPolygon(obj,
     626              :                          obj->getStringAttribute(SUMO_ATTR_ID),
     627              :                          obj->getStringAttribute(SUMO_ATTR_TYPE),
     628              :                          obj->getColorAttribute(SUMO_ATTR_COLOR),
     629              :                          obj->getDoubleAttribute(SUMO_ATTR_LAYER),
     630              :                          obj->getDoubleAttribute(SUMO_ATTR_ANGLE),
     631              :                          obj->getStringAttribute(SUMO_ATTR_IMGFILE),
     632            0 :                          obj->getBoolAttribute(SUMO_ATTR_RELATIVEPATH),
     633              :                          obj->getPositionVectorAttribute(SUMO_ATTR_SHAPE),
     634            0 :                          obj->getBoolAttribute(SUMO_ATTR_GEO),
     635            0 :                          obj->getBoolAttribute(SUMO_ATTR_FILL),
     636              :                          obj->getDoubleAttribute(SUMO_ATTR_LINEWIDTH),
     637              :                          obj->getStringAttribute(SUMO_ATTR_NAME),
     638            0 :                          obj->getParameters());
     639            0 :             break;
     640              :         // POI
     641            0 :         case SUMO_TAG_POI:
     642              :             // check if we want to create a POI, POILane or POIGEO
     643            0 :             if (obj->hasDoubleAttribute(SUMO_ATTR_X)) {
     644              :                 // build POI over view
     645            0 :                 buildPOI(obj,
     646              :                          obj->getStringAttribute(SUMO_ATTR_ID),
     647              :                          obj->getStringAttribute(SUMO_ATTR_TYPE),
     648              :                          obj->getColorAttribute(SUMO_ATTR_COLOR),
     649              :                          obj->getDoubleAttribute(SUMO_ATTR_X),
     650              :                          obj->getDoubleAttribute(SUMO_ATTR_Y),
     651              :                          obj->getStringAttribute(SUMO_ATTR_ICON),
     652              :                          obj->getDoubleAttribute(SUMO_ATTR_LAYER),
     653              :                          obj->getDoubleAttribute(SUMO_ATTR_ANGLE),
     654              :                          obj->getStringAttribute(SUMO_ATTR_IMGFILE),
     655            0 :                          obj->getBoolAttribute(SUMO_ATTR_RELATIVEPATH),
     656              :                          obj->getDoubleAttribute(SUMO_ATTR_WIDTH),
     657              :                          obj->getDoubleAttribute(SUMO_ATTR_HEIGHT),
     658              :                          obj->getStringAttribute(SUMO_ATTR_NAME),
     659            0 :                          obj->getParameters());
     660            0 :             } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
     661              :                 // build POI over Lane
     662            0 :                 buildPOILane(obj,
     663              :                              obj->getStringAttribute(SUMO_ATTR_ID),
     664              :                              obj->getStringAttribute(SUMO_ATTR_TYPE),
     665              :                              obj->getColorAttribute(SUMO_ATTR_COLOR),
     666              :                              obj->getStringAttribute(SUMO_ATTR_LANE),
     667              :                              obj->getDoubleAttribute(SUMO_ATTR_POSITION),
     668            0 :                              obj->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS),
     669              :                              obj->getDoubleAttribute(SUMO_ATTR_POSITION_LAT),
     670              :                              obj->getStringAttribute(SUMO_ATTR_ICON),
     671              :                              obj->getDoubleAttribute(SUMO_ATTR_LAYER),
     672              :                              obj->getDoubleAttribute(SUMO_ATTR_ANGLE),
     673              :                              obj->getStringAttribute(SUMO_ATTR_IMGFILE),
     674            0 :                              obj->getBoolAttribute(SUMO_ATTR_RELATIVEPATH),
     675              :                              obj->getDoubleAttribute(SUMO_ATTR_WIDTH),
     676              :                              obj->getDoubleAttribute(SUMO_ATTR_HEIGHT),
     677              :                              obj->getStringAttribute(SUMO_ATTR_NAME),
     678            0 :                              obj->getParameters());
     679              :             } else {
     680              :                 // build POIGEO over view
     681            0 :                 buildPOIGeo(obj,
     682              :                             obj->getStringAttribute(SUMO_ATTR_ID),
     683              :                             obj->getStringAttribute(SUMO_ATTR_TYPE),
     684              :                             obj->getColorAttribute(SUMO_ATTR_COLOR),
     685              :                             obj->getDoubleAttribute(SUMO_ATTR_LON),
     686              :                             obj->getDoubleAttribute(SUMO_ATTR_LAT),
     687              :                             obj->getStringAttribute(SUMO_ATTR_ICON),
     688              :                             obj->getDoubleAttribute(SUMO_ATTR_LAYER),
     689              :                             obj->getDoubleAttribute(SUMO_ATTR_ANGLE),
     690              :                             obj->getStringAttribute(SUMO_ATTR_IMGFILE),
     691            0 :                             obj->getBoolAttribute(SUMO_ATTR_RELATIVEPATH),
     692              :                             obj->getDoubleAttribute(SUMO_ATTR_WIDTH),
     693              :                             obj->getDoubleAttribute(SUMO_ATTR_HEIGHT),
     694              :                             obj->getStringAttribute(SUMO_ATTR_NAME),
     695            0 :                             obj->getParameters());
     696              :             }
     697              :             break;
     698              :         // Jps WalkableArea
     699            0 :         case GNE_TAG_JPS_WALKABLEAREA:
     700            0 :             buildJpsWalkableArea(obj,
     701              :                                  obj->getStringAttribute(SUMO_ATTR_ID),
     702              :                                  obj->getPositionVectorAttribute(SUMO_ATTR_SHAPE),
     703            0 :                                  obj->getBoolAttribute(SUMO_ATTR_GEO),
     704              :                                  obj->getStringAttribute(SUMO_ATTR_NAME),
     705            0 :                                  obj->getParameters());
     706            0 :             break;
     707              :         // Jps Obstacle
     708            0 :         case GNE_TAG_JPS_OBSTACLE:
     709            0 :             buildJpsObstacle(obj,
     710              :                              obj->getStringAttribute(SUMO_ATTR_ID),
     711              :                              obj->getPositionVectorAttribute(SUMO_ATTR_SHAPE),
     712            0 :                              obj->getBoolAttribute(SUMO_ATTR_GEO),
     713              :                              obj->getStringAttribute(SUMO_ATTR_NAME),
     714            0 :                              obj->getParameters());
     715            0 :             break;
     716              :         default:
     717              :             break;
     718              :     }
     719              :     // now iterate over childrens
     720            0 :     for (const auto& child : obj->getSumoBaseObjectChildren()) {
     721              :         // call this function recursively
     722            0 :         parseSumoBaseObject(child);
     723              :     }
     724            0 : }
     725              : 
     726              : 
     727              : bool
     728            0 : AdditionalHandler::isErrorCreatingElement() const {
     729            0 :     return myErrorCreatingElement;
     730              : }
     731              : 
     732              : 
     733              : void
     734            0 : AdditionalHandler::writeError(const std::string& error) {
     735            0 :     WRITE_ERROR(error);
     736            0 :     myErrorCreatingElement = true;
     737            0 : }
     738              : 
     739              : 
     740              : void
     741            0 : AdditionalHandler::parseBusStopAttributes(const SUMOSAXAttributes& attrs) {
     742              :     // declare Ok Flag
     743            0 :     bool parsedOk = true;
     744              :     // needed attributes
     745            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
     746            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
     747              :     // optional attributes
     748            0 :     const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     749            0 :     const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     750            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
     751            0 :     const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
     752            0 :     const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
     753            0 :     const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
     754            0 :     const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
     755            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
     756              :     // continue if flag is ok
     757            0 :     if (parsedOk) {
     758              :         // set tag
     759            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_BUS_STOP);
     760              :         // add all attributes
     761            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
     762            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
     763            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_STARTPOS, startPos);
     764            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
     765            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
     766            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_LINES, lines);
     767            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addIntAttribute(SUMO_ATTR_PERSON_CAPACITY, personCapacity);
     768            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_PARKING_LENGTH, parkingLength);
     769            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addColorAttribute(SUMO_ATTR_COLOR, color);
     770            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
     771              :     }
     772            0 : }
     773              : 
     774              : 
     775              : void
     776            0 : AdditionalHandler::parseTrainStopAttributes(const SUMOSAXAttributes& attrs) {
     777              :     // declare Ok Flag
     778            0 :     bool parsedOk = true;
     779              :     // needed attributes
     780            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
     781            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
     782              :     // optional attributes
     783            0 :     const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     784            0 :     const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     785            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
     786            0 :     const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
     787            0 :     const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
     788            0 :     const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
     789            0 :     const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
     790            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
     791              :     // continue if flag is ok
     792            0 :     if (parsedOk) {
     793              :         // set tag
     794            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_TRAIN_STOP);
     795              :         // add all attributes
     796            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
     797            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
     798            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_STARTPOS, startPos);
     799            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
     800            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
     801            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_LINES, lines);
     802            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addIntAttribute(SUMO_ATTR_PERSON_CAPACITY, personCapacity);
     803            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_PARKING_LENGTH, parkingLength);
     804            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addColorAttribute(SUMO_ATTR_COLOR, color);
     805            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
     806              :     }
     807            0 : }
     808              : 
     809              : 
     810              : void
     811            0 : AdditionalHandler::parseAccessAttributes(const SUMOSAXAttributes& attrs) {
     812              :     // declare Ok Flag
     813            0 :     bool parsedOk = true;
     814              :     // needed attributes
     815            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
     816            0 :     const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
     817              :     // optional attributes
     818            0 :     const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00); /* in future updates, INVALID_DOUBLE */
     819            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
     820              :     // check parent
     821            0 :     checkParent(SUMO_TAG_ACCESS, {SUMO_TAG_BUS_STOP, SUMO_TAG_TRAIN_STOP}, parsedOk);
     822              :     // continue if flag is ok
     823            0 :     if (parsedOk) {
     824              :         // set tag
     825            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_ACCESS);
     826              :         // add all attributes
     827            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
     828            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_POSITION, position);
     829            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LENGTH, length);
     830            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
     831              :     }
     832            0 : }
     833              : 
     834              : 
     835              : void
     836            0 : AdditionalHandler::parseContainerStopAttributes(const SUMOSAXAttributes& attrs) {
     837              :     // declare Ok Flag
     838            0 :     bool parsedOk = true;
     839              :     // needed attributes
     840            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
     841            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
     842              :     // optional attributes
     843            0 :     const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     844            0 :     const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     845            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
     846            0 :     const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
     847            0 :     const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
     848            0 :     const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
     849            0 :     const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
     850            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
     851              :     // continue if flag is ok
     852            0 :     if (parsedOk) {
     853              :         // set tag
     854            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_CONTAINER_STOP);
     855              :         // add all attributes
     856            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
     857            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
     858            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_STARTPOS, startPos);
     859            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
     860            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
     861            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_LINES, lines);
     862            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addIntAttribute(SUMO_ATTR_CONTAINER_CAPACITY, containerCapacity);
     863            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_PARKING_LENGTH, parkingLength);
     864            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addColorAttribute(SUMO_ATTR_COLOR, color);
     865            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
     866              :     }
     867            0 : }
     868              : 
     869              : 
     870              : void
     871            0 : AdditionalHandler::parseChargingStationAttributes(const SUMOSAXAttributes& attrs) {
     872              :     // declare Ok Flag
     873            0 :     bool parsedOk = true;
     874              :     // needed attributes
     875            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
     876            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
     877              :     // optional attributes
     878            0 :     const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     879            0 :     const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     880            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
     881            0 :     const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
     882            0 :     const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
     883            0 :     const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
     884            0 :     const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
     885            0 :     const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
     886            0 :     const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, "normal");
     887            0 :     const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
     888            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
     889            0 :     const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
     890              : 
     891              :     // check charge type
     892            0 :     if ((chargeType != "normal") && (chargeType != "electric") && (chargeType != "fuel")) {
     893            0 :         writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
     894            0 :         parsedOk = false;
     895              :     }
     896              :     // continue if flag is ok
     897            0 :     if (parsedOk) {
     898              :         // set tag
     899            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_CHARGING_STATION);
     900              :         // add all attributes
     901            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
     902            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
     903            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_STARTPOS, startPos);
     904            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
     905            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
     906            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_LINES, lines);
     907            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_CHARGINGPOWER, chargingPower);
     908            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_EFFICIENCY, efficiency);
     909            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_CHARGEINTRANSIT, chargeInTransit);
     910            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_CHARGEDELAY, chargeDelay);
     911            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_CHARGETYPE, chargeType);
     912            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_WAITINGTIME, waitingTime);
     913            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
     914            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_PARKING_AREA, parkingAreaID);
     915              :     }
     916            0 : }
     917              : 
     918              : 
     919              : void
     920            0 : AdditionalHandler::parseParkingAreaAttributes(const SUMOSAXAttributes& attrs) {
     921              :     // declare Ok Flag
     922            0 :     bool parsedOk = true;
     923              :     // needed attributes
     924            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
     925            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
     926              :     // optional attributes
     927            0 :     const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     928            0 :     const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
     929            0 :     const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
     930            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
     931            0 :     const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
     932            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
     933            0 :     const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
     934            0 :     const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
     935            0 :     const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
     936            0 :     const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
     937            0 :     const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
     938            0 :     const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
     939              : 
     940              :     // continue if flag is ok
     941            0 :     if (parsedOk) {
     942              :         // set tag
     943            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_PARKING_AREA);
     944              :         // add all attributes
     945            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
     946            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
     947            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_STARTPOS, startPos);
     948            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
     949            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_DEPARTPOS, departPos);
     950            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
     951            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_ACCEPTED_BADGES, badges);
     952            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
     953            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addIntAttribute(SUMO_ATTR_ROADSIDE_CAPACITY, roadSideCapacity);
     954            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_ONROAD, onRoad);
     955            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_WIDTH, width);
     956            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LENGTH, length);
     957            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ANGLE, angle);
     958            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_LEFTHAND, lefthand);
     959              :     }
     960            0 : }
     961              : 
     962              : 
     963              : void
     964            0 : AdditionalHandler::parseParkingSpaceAttributes(const SUMOSAXAttributes& attrs) {
     965              :     // declare Ok Flag
     966            0 :     bool parsedOk = true;
     967              :     // needed attributes
     968            0 :     const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
     969            0 :     const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
     970              :     // optional attributes
     971            0 :     const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
     972            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
     973            0 :     const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
     974            0 :     const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
     975            0 :     const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
     976            0 :     const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
     977              :     // check parent
     978            0 :     checkParent(SUMO_TAG_PARKING_SPACE, {SUMO_TAG_PARKING_AREA}, parsedOk);
     979              :     // continue if flag is ok
     980            0 :     if (parsedOk) {
     981              :         // set tag
     982            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_PARKING_SPACE);
     983              :         // add all attributes
     984            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_X, x);
     985            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_Y, y);
     986            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_Z, z);
     987            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
     988            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_WIDTH, width);
     989            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LENGTH, length);
     990            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ANGLE, angle);
     991            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_SLOPE, slope);
     992              :     }
     993            0 : }
     994              : 
     995              : 
     996              : void
     997            0 : AdditionalHandler::parseE1Attributes(const SUMOSAXAttributes& attrs) {
     998              :     // declare Ok Flag
     999            0 :     bool parsedOk = true;
    1000              :     // needed attributes
    1001            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1002            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
    1003            0 :     const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
    1004            0 :     const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
    1005            0 :     const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
    1006              :     // optional attributes
    1007            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1008            0 :     const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1009            0 :     const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
    1010            0 :     const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
    1011            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
    1012              :     // continue if flag is ok
    1013            0 :     if (parsedOk && checkDetectPersons(SUMO_TAG_E1DETECTOR, id, detectPersons)) {
    1014              :         // set tag
    1015            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_E1DETECTOR);
    1016              :         // add all attributes
    1017            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1018            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
    1019            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, position);
    1020            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_PERIOD, period);
    1021            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_FILE, file);
    1022            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1023            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1024            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_NEXT_EDGES, nextEdges);
    1025            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_DETECT_PERSONS, detectPersons);
    1026            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
    1027              :     }
    1028            0 : }
    1029              : 
    1030              : 
    1031              : void
    1032            0 : AdditionalHandler::parseE2Attributes(const SUMOSAXAttributes& attrs) {
    1033              :     // declare Ok Flag
    1034            0 :     bool parsedOk = true;
    1035            0 :     const int positionDef = attrs.hasAttribute(SUMO_ATTR_POSITION) ? 1 : 0;
    1036            0 :     const int endPosDef = attrs.hasAttribute(SUMO_ATTR_ENDPOS) ? 1 : 0;
    1037            0 :     const int lengthDef = attrs.hasAttribute(SUMO_ATTR_LENGTH) ? 1 : 0;
    1038              :     // check attributes
    1039            0 :     if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) > 2)) {
    1040            0 :         writeError(TL("'pos', 'endPos' and 'length' cannot be defined together in a single lane area detector."));
    1041            0 :     } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) < 2)) {
    1042            0 :         writeError(TL("A single lane area detector requires two parameters of those 'pos', 'endPos' and 'length'."));
    1043              :     } else {
    1044              :         // needed attributes
    1045            0 :         const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1046            0 :         const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
    1047              :         // special attributes
    1048            0 :         const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
    1049            0 :         const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
    1050            0 :         const double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
    1051            0 :         const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
    1052            0 :         const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
    1053              :         // optional attributes
    1054            0 :         const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
    1055            0 :         const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
    1056            0 :         const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1057            0 :         const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
    1058            0 :         const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
    1059            0 :         const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
    1060            0 :         const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1061            0 :         const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
    1062            0 :         const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
    1063            0 :         const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
    1064            0 :         const bool show = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), parsedOk, true);
    1065              :         // continue if flag is ok
    1066            0 :         if (parsedOk && checkDetectPersons(SUMO_TAG_E2DETECTOR, id, detectPersons)) {
    1067              :             // set tag
    1068            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_E2DETECTOR);
    1069              :             // add attributes depending of Lane/Lanes
    1070            0 :             if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
    1071            0 :                 myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
    1072            0 :                 if (positionDef == 0) {
    1073            0 :                     myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, endPos - length);
    1074            0 :                     myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LENGTH, length);
    1075            0 :                 } else if (endPosDef == 0) {
    1076            0 :                     myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, position);
    1077            0 :                     myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LENGTH, length);
    1078            0 :                 } else if (lengthDef == 0) {
    1079            0 :                     myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, position);
    1080            0 :                     myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LENGTH, endPos - position);
    1081              :                 }
    1082              :             } else {
    1083            0 :                 myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_LANES, laneIds);
    1084            0 :                 myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, position);
    1085            0 :                 myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
    1086              :             }
    1087              :             // add all attributes
    1088            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1089            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_PERIOD, period);
    1090            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_TLID, trafficLight);
    1091            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_FILE, file);
    1092            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1093            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_NEXT_EDGES, nextEdges);
    1094            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_DETECT_PERSONS, detectPersons);
    1095            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1096            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_HALTING_TIME_THRESHOLD, haltingTimeThreshold);
    1097            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_HALTING_SPEED_THRESHOLD, haltingSpeedThreshold);
    1098            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_JAM_DIST_THRESHOLD, jamDistThreshold);
    1099            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
    1100            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_SHOW_DETECTOR, show);
    1101              :         }
    1102            0 :     }
    1103            0 : }
    1104              : 
    1105              : 
    1106              : void
    1107            0 : AdditionalHandler::parseE3Attributes(const SUMOSAXAttributes& attrs) {
    1108              :     // declare Ok Flag
    1109            0 :     bool parsedOk = true;
    1110              :     // needed attributes
    1111            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1112            0 :     const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
    1113            0 :     const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
    1114              :     // optional attributes
    1115            0 :     const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
    1116            0 :     const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1117            0 :     const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
    1118            0 :     const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
    1119            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1120            0 :     const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
    1121            0 :     const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
    1122            0 :     const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), parsedOk, false);
    1123            0 :     const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
    1124              :     // continue if flag is ok
    1125            0 :     if (parsedOk && checkDetectPersons(SUMO_TAG_E3DETECTOR, id, detectPersons)) {
    1126              :         // set tag
    1127            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_E3DETECTOR);
    1128              :         // add all attributes
    1129            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1130            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_FILE, file);
    1131            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_PERIOD, period);
    1132            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionAttribute(SUMO_ATTR_POSITION, pos);
    1133            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1134            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_NEXT_EDGES, nextEdges);
    1135            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_DETECT_PERSONS, detectPersons);
    1136            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1137            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_HALTING_TIME_THRESHOLD, haltingTimeThreshold);
    1138            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_HALTING_SPEED_THRESHOLD, haltingSpeedThreshold);
    1139            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_OPEN_ENTRY, openEntry);
    1140            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_EXPECT_ARRIVAL, expectedArrival);
    1141              :     }
    1142            0 : }
    1143              : 
    1144              : 
    1145              : void
    1146            0 : AdditionalHandler::parseEntryAttributes(const SUMOSAXAttributes& attrs) {
    1147              :     // declare Ok Flag
    1148            0 :     bool parsedOk = true;
    1149              :     // needed attributes
    1150            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
    1151            0 :     const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
    1152              :     // optional attributes
    1153            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
    1154              :     // check parent
    1155            0 :     checkParent(SUMO_TAG_DET_ENTRY, {SUMO_TAG_E3DETECTOR}, parsedOk);
    1156              :     // continue if flag is ok
    1157            0 :     if (parsedOk) {
    1158              :         // set tag
    1159            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_DET_ENTRY);
    1160              :         // add all attributes
    1161            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
    1162            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, position);
    1163            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
    1164              :     }
    1165            0 : }
    1166              : 
    1167              : 
    1168              : void
    1169            0 : AdditionalHandler::parseExitAttributes(const SUMOSAXAttributes& attrs) {
    1170              :     // declare Ok Flag
    1171            0 :     bool parsedOk = true;
    1172              :     // needed attributes
    1173            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
    1174            0 :     const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
    1175              :     // optional attributes
    1176            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
    1177              :     // check parent
    1178            0 :     checkParent(SUMO_TAG_DET_EXIT, {SUMO_TAG_E3DETECTOR}, parsedOk);
    1179              :     // continue if flag is ok
    1180            0 :     if (parsedOk) {
    1181              :         // set tag
    1182            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_DET_EXIT);
    1183              :         // add all attributes
    1184            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
    1185            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, position);
    1186            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
    1187              :     }
    1188            0 : }
    1189              : 
    1190              : 
    1191              : void
    1192            0 : AdditionalHandler::parseE1InstantAttributes(const SUMOSAXAttributes& attrs) {
    1193              :     // declare Ok Flag
    1194            0 :     bool parsedOk = true;
    1195              :     // needed attributes
    1196            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1197            0 :     const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
    1198            0 :     const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
    1199            0 :     const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
    1200              :     // optional attributes
    1201            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1202            0 :     const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1203            0 :     const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
    1204            0 :     const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
    1205            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
    1206              :     // continue if flag is ok
    1207            0 :     if (parsedOk && checkDetectPersons(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, detectPersons)) {
    1208              :         // set tag
    1209            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_INSTANT_INDUCTION_LOOP);
    1210              :         // add all attributes
    1211            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1212            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, laneId);
    1213            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, position);
    1214            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_FILE, file);
    1215            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1216            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_NEXT_EDGES, nextEdges);
    1217            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_DETECT_PERSONS, detectPersons);
    1218            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1219            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
    1220              :     }
    1221            0 : }
    1222              : 
    1223              : 
    1224              : void
    1225            0 : AdditionalHandler::parseTAZAttributes(const SUMOSAXAttributes& attrs) {
    1226              :     // declare Ok Flag
    1227            0 :     bool parsedOk = true;
    1228              :     // needed attributes
    1229            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1230              :     // optional attributes
    1231            0 :     const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
    1232            0 :     const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
    1233            0 :     const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
    1234            0 :     const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
    1235            0 :     const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
    1236            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1237              :     // continue if flag is ok
    1238            0 :     if (parsedOk) {
    1239              :         // set tag
    1240            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_TAZ);
    1241              :         // add all attributes
    1242            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1243            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionVectorAttribute(SUMO_ATTR_SHAPE, shape);
    1244            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionAttribute(SUMO_ATTR_CENTER, center);
    1245            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FILL, fill);
    1246            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_EDGES, edges);
    1247            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addColorAttribute(SUMO_ATTR_COLOR, color);
    1248            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1249              :     }
    1250            0 : }
    1251              : 
    1252              : 
    1253              : void
    1254            0 : AdditionalHandler::parseTAZSourceAttributes(const SUMOSAXAttributes& attrs) {
    1255              :     // declare Ok Flag
    1256            0 :     bool parsedOk = true;
    1257              :     // needed attributes
    1258            0 :     const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1259            0 :     const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
    1260              :     // check parent
    1261            0 :     checkParent(SUMO_TAG_TAZSOURCE, {SUMO_TAG_TAZ}, parsedOk);
    1262              :     // continue if flag is ok
    1263            0 :     if (parsedOk) {
    1264              :         // set tag
    1265            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_TAZSOURCE);
    1266              :         // add all attributes
    1267            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, edgeID);
    1268            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_WEIGHT, weight);
    1269              :     }
    1270            0 : }
    1271              : 
    1272              : 
    1273              : void
    1274            0 : AdditionalHandler::parseTAZSinkAttributes(const SUMOSAXAttributes& attrs) {
    1275              :     // declare Ok Flag
    1276            0 :     bool parsedOk = true;
    1277              :     // needed attributes
    1278            0 :     const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1279            0 :     const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
    1280              :     // check parent
    1281            0 :     checkParent(SUMO_TAG_TAZSINK, {SUMO_TAG_TAZ}, parsedOk);
    1282              :     // continue if flag is ok
    1283            0 :     if (parsedOk) {
    1284              :         // set tag
    1285            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_TAZSINK);
    1286              :         // add all attributes
    1287            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, edgeID);
    1288            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_WEIGHT, weight);
    1289              :     }
    1290            0 : }
    1291              : 
    1292              : 
    1293              : void
    1294            0 : AdditionalHandler::parseVariableSpeedSignAttributes(const SUMOSAXAttributes& attrs) {
    1295              :     // declare Ok Flag
    1296            0 :     bool parsedOk = true;
    1297              :     // needed attributes
    1298            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1299            0 :     const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
    1300              :     // optional attributes
    1301            0 :     const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
    1302            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1303            0 :     const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1304              :     // continue if flag is ok
    1305            0 :     if (parsedOk) {
    1306              :         // set tag
    1307            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_VSS);
    1308              :         // add all attributes
    1309            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1310            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_LANES, lanes);
    1311            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionAttribute(SUMO_ATTR_POSITION, pos);
    1312            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1313            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1314              :     }
    1315            0 : }
    1316              : 
    1317              : 
    1318              : void
    1319            0 : AdditionalHandler::parseVariableSpeedSignStepAttributes(const SUMOSAXAttributes& attrs) {
    1320              :     // declare Ok Flag
    1321            0 :     bool parsedOk = true;
    1322              :     // needed attributes
    1323            0 :     const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
    1324              :     // optional attributes
    1325            0 :     const std::string speed = attrs.getOpt<std::string>(SUMO_ATTR_SPEED, "", parsedOk, "");
    1326              :     // check parent
    1327            0 :     checkParent(SUMO_TAG_STEP, {SUMO_TAG_VSS}, parsedOk);
    1328              :     // continue if flag is ok
    1329            0 :     if (parsedOk) {
    1330              :         // set tag
    1331            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_STEP);
    1332              :         // add all attributes
    1333            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_TIME, time);
    1334            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_SPEED, speed);
    1335              :     }
    1336            0 : }
    1337              : 
    1338              : 
    1339              : void
    1340            0 : AdditionalHandler::parseCalibratorAttributes(const SUMOSAXAttributes& attrs) {
    1341              :     // declare Ok Flag
    1342            0 :     bool parsedOk = true;
    1343              :     // check that frecuency and trafficLight aren't defined together
    1344            0 :     if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
    1345            0 :             (!attrs.hasAttribute(SUMO_ATTR_EDGE) && !attrs.hasAttribute(SUMO_ATTR_LANE))) {
    1346            0 :         writeError(TL("Calibrators need either an edge or a lane"));
    1347            0 :         parsedOk = false;
    1348              :     }
    1349              :     // needed attributes
    1350            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1351            0 :     const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
    1352              :     // special attributes
    1353            0 :     const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
    1354            0 :     const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
    1355              :     // optional attributes
    1356            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1357            0 :     const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
    1358            0 :     const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
    1359            0 :     const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
    1360            0 :     const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
    1361            0 :     const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1362              :     // continue if flag is ok
    1363            0 :     if (parsedOk) {
    1364              :         // set tag depending of edge/lane
    1365            0 :         if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
    1366            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_CALIBRATOR);
    1367            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_EDGE, edge);
    1368              :         } else {
    1369            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(GNE_TAG_CALIBRATOR_LANE);
    1370            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, lane);
    1371              :         }
    1372            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1373            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, pos);
    1374            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1375            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_PERIOD, period);
    1376            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ROUTEPROBE, routeProbe);
    1377            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold);
    1378            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_OUTPUT, output);
    1379            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1380              :     }
    1381            0 : }
    1382              : 
    1383              : 
    1384              : void
    1385            0 : AdditionalHandler::parseCalibratorFlowAttributes(const SUMOSAXAttributes& attrs) {
    1386              :     // declare Ok Flag
    1387            0 :     bool parsedOk = true;
    1388              :     // check parent
    1389            0 :     if (myCommonXMLStructure.getCurrentSumoBaseObject()->getParentSumoBaseObject() &&
    1390            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->getParentSumoBaseObject()->getTag() != SUMO_TAG_ROOTFILE) {
    1391              :         // check that frecuency and trafficLight aren't defined together
    1392            0 :         if (!attrs.hasAttribute(SUMO_ATTR_TYPE) && !attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR) && !attrs.hasAttribute(SUMO_ATTR_SPEED)) {
    1393            0 :             writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
    1394              :         }
    1395              :         // first parse flow
    1396            0 :         SUMOVehicleParameter* flowParameter = SUMOVehicleParserHelper::parseVehicleAttributes(SUMO_TAG_FLOW, attrs, false, true, true);
    1397            0 :         if (flowParameter) {
    1398              :             // set VPH and speed
    1399            0 :             if (attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR)) {
    1400            0 :                 flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
    1401            0 :                 flowParameter->parametersSet |= VEHPARS_VPH_SET;
    1402              :             }
    1403            0 :             if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
    1404            0 :                 flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
    1405            0 :                 flowParameter->parametersSet |= VEHPARS_CALIBRATORSPEED_SET;
    1406              :             }
    1407              :             // set begin and end
    1408            0 :             flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
    1409            0 :             flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
    1410            0 :             if (parsedOk) {
    1411              :                 // set tag
    1412            0 :                 myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_FLOW);
    1413              :                 // set vehicle parameters
    1414            0 :                 myCommonXMLStructure.getCurrentSumoBaseObject()->setVehicleParameter(flowParameter);
    1415              :                 // delete flow parameter (because in XMLStructure we have a copy)
    1416            0 :                 delete flowParameter;
    1417              :             }
    1418              :         }
    1419              :     }
    1420            0 : }
    1421              : 
    1422              : 
    1423              : void
    1424            0 : AdditionalHandler::parseRerouterAttributes(const SUMOSAXAttributes& attrs) {
    1425              :     // declare Ok Flag
    1426            0 :     bool parsedOk = true;
    1427              :     // needed attributes
    1428            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1429            0 :     const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
    1430              :     // optional attributes
    1431            0 :     const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
    1432            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1433            0 :     const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
    1434            0 :     SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
    1435            0 :     const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1436            0 :     const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
    1437            0 :     const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
    1438              :     // continue if flag is ok
    1439            0 :     if (parsedOk) {
    1440              :         // set tag
    1441            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_REROUTER);
    1442              :         // add all attributes
    1443            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1444            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_EDGES, edges);
    1445            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionAttribute(SUMO_ATTR_POSITION, pos);
    1446            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1447            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_PROB, probability);
    1448            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold);
    1449            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1450            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_OFF, off);
    1451            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_OPTIONAL, optional);
    1452              :     }
    1453            0 : }
    1454              : 
    1455              : 
    1456              : void
    1457            0 : AdditionalHandler::parseRerouterIntervalAttributes(const SUMOSAXAttributes& attrs) {
    1458              :     // declare Ok Flag
    1459            0 :     bool parsedOk = true;
    1460              :     // needed attributes
    1461            0 :     const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
    1462            0 :     const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
    1463              :     // check parent
    1464            0 :     checkParent(SUMO_TAG_INTERVAL, {SUMO_TAG_REROUTER}, parsedOk);
    1465              :     // continue if flag is ok
    1466            0 :     if (parsedOk) {
    1467              :         // set tag
    1468            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_INTERVAL);
    1469              :         // add all attributes
    1470            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_BEGIN, begin);
    1471            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_END, end);
    1472              :     }
    1473            0 : }
    1474              : 
    1475              : 
    1476              : void
    1477            0 : AdditionalHandler::parseClosingLaneRerouteAttributes(const SUMOSAXAttributes& attrs) {
    1478              :     // declare Ok Flag
    1479            0 :     bool parsedOk = true;
    1480              :     // needed attributes
    1481            0 :     const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1482              :     // optional attributes
    1483            0 :     const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
    1484            0 :     const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
    1485              :     // check parent
    1486            0 :     checkParent(SUMO_TAG_CLOSING_LANE_REROUTE, {SUMO_TAG_INTERVAL}, parsedOk);
    1487              :     // continue if flag is ok
    1488            0 :     if (parsedOk) {
    1489              :         // set tag
    1490            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_CLOSING_LANE_REROUTE);
    1491              :         // add all attributes
    1492            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, laneID);
    1493            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ALLOW, allow);
    1494            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_DISALLOW, disallow);
    1495              :     }
    1496            0 : }
    1497              : 
    1498              : 
    1499              : void
    1500            0 : AdditionalHandler::parseClosingRerouteAttributes(const SUMOSAXAttributes& attrs) {
    1501              :     // declare Ok Flag
    1502            0 :     bool parsedOk = true;
    1503              :     // needed attributes
    1504            0 :     const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1505              :     // optional attributes
    1506            0 :     const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
    1507            0 :     const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
    1508              :     // check parent
    1509            0 :     checkParent(SUMO_TAG_CLOSING_REROUTE, {SUMO_TAG_INTERVAL}, parsedOk);
    1510              :     // continue if flag is ok
    1511            0 :     if (parsedOk) {
    1512              :         // set tag
    1513            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_CLOSING_REROUTE);
    1514              :         // add all attributes
    1515            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, edgeID);
    1516            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ALLOW, allow);
    1517            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_DISALLOW, disallow);
    1518              :     }
    1519            0 : }
    1520              : 
    1521              : 
    1522              : void
    1523            0 : AdditionalHandler::parseDestProbRerouteAttributes(const SUMOSAXAttributes& attrs) {
    1524              :     // declare Ok Flag
    1525            0 :     bool parsedOk = true;
    1526              :     // needed attributes
    1527            0 :     const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1528            0 :     const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
    1529              :     // check parent
    1530            0 :     checkParent(SUMO_TAG_DEST_PROB_REROUTE, {SUMO_TAG_INTERVAL}, parsedOk);
    1531              :     // continue if flag is ok
    1532            0 :     if (parsedOk) {
    1533            0 :         if (probability < 0) {
    1534            0 :             writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_DEST_PROB_REROUTE)));
    1535              :         } else {
    1536              :             // set tag
    1537            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_DEST_PROB_REROUTE);
    1538              :             // add all attributes
    1539            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, edgeID);
    1540            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_PROB, probability);
    1541              :         }
    1542              :     }
    1543            0 : }
    1544              : 
    1545              : 
    1546              : void
    1547            0 : AdditionalHandler::parseParkingAreaRerouteAttributes(const SUMOSAXAttributes& attrs) {
    1548              :     // declare Ok Flag
    1549            0 :     bool parsedOk = true;
    1550              :     // needed attributes
    1551            0 :     const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1552            0 :     const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
    1553              :     // optional attributes
    1554            0 :     const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
    1555              :     // check parent
    1556            0 :     checkParent(SUMO_TAG_PARKING_AREA_REROUTE, {SUMO_TAG_INTERVAL}, parsedOk);
    1557              :     // continue if flag is ok
    1558            0 :     if (parsedOk) {
    1559            0 :         if (probability < 0) {
    1560            0 :             writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_PARKING_AREA_REROUTE)));
    1561              :         } else {
    1562              :             // set tag
    1563            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_PARKING_AREA_REROUTE);
    1564              :             // add all attributes
    1565            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, parkingAreaID);
    1566            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_PROB, probability);
    1567            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_VISIBLE, visible);
    1568              :         }
    1569              :     }
    1570            0 : }
    1571              : 
    1572              : 
    1573              : void
    1574            0 : AdditionalHandler::parseRouteProbRerouteAttributes(const SUMOSAXAttributes& attrs) {
    1575              :     // declare Ok Flag
    1576            0 :     bool parsedOk = true;
    1577              :     // needed attributes
    1578            0 :     const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1579            0 :     const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
    1580              :     // check parent
    1581            0 :     checkParent(SUMO_TAG_ROUTE_PROB_REROUTE, {SUMO_TAG_INTERVAL}, parsedOk);
    1582              :     // continue if flag is ok
    1583            0 :     if (parsedOk) {
    1584            0 :         if (probability < 0) {
    1585            0 :             writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_ROUTE_PROB_REROUTE)));
    1586              :         } else {
    1587              :             // set tag
    1588            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_ROUTE_PROB_REROUTE);
    1589              :             // add all attributes
    1590            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, routeID);
    1591            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_PROB, probability);
    1592              :         }
    1593              :     }
    1594            0 : }
    1595              : 
    1596              : 
    1597              : void
    1598            0 : AdditionalHandler::parseRouteProbeAttributes(const SUMOSAXAttributes& attrs) {
    1599              :     // declare Ok Flag
    1600            0 :     bool parsedOk = true;
    1601              :     // needed attributes
    1602            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1603            0 :     const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
    1604            0 :     const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
    1605            0 :     const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
    1606            0 :     const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
    1607              :     // optional attributes
    1608            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1609            0 :     const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
    1610              :     // continue if flag is ok
    1611            0 :     if (parsedOk) {
    1612              :         // set tag
    1613            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_ROUTEPROBE);
    1614              :         // add all attributes
    1615            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1616            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_EDGE, edge);
    1617            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_FILE, file);
    1618            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_PERIOD, period);
    1619            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1620            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_BEGIN, begin);
    1621            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_VTYPES, vehicleTypes);
    1622              :     }
    1623            0 : }
    1624              : 
    1625              : 
    1626              : void
    1627            0 : AdditionalHandler::parseVaporizerAttributes(const SUMOSAXAttributes& attrs) {
    1628              :     // declare Ok Flag
    1629            0 :     bool parsedOk = true;
    1630              :     // needed attributes
    1631            0 :     const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1632            0 :     SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
    1633            0 :     SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
    1634              :     // optional attributes
    1635            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
    1636              :     // continue if flag is ok
    1637            0 :     if (parsedOk) {
    1638              :         // set tag
    1639            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_VAPORIZER);
    1640              :         // add all attributes
    1641            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, edgeID);
    1642            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_BEGIN, begin);
    1643            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addTimeAttribute(SUMO_ATTR_END, end);
    1644            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1645              :     }
    1646            0 : }
    1647              : 
    1648              : 
    1649              : void
    1650            0 : AdditionalHandler::parseTractionSubstation(const SUMOSAXAttributes& attrs) {
    1651              :     // declare Ok Flag
    1652            0 :     bool parsedOk = true;
    1653              :     // needed attributes
    1654            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1655              :     // optional attributes
    1656            0 :     const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
    1657            0 :     const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
    1658            0 :     const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
    1659              :     // continue if flag is ok
    1660            0 :     if (parsedOk) {
    1661              :         // set tag
    1662            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_TRACTION_SUBSTATION);
    1663              :         // add all attributes
    1664            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1665            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionAttribute(SUMO_ATTR_POSITION, pos);
    1666            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_VOLTAGE, voltage);
    1667            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_CURRENTLIMIT, currentLimit);
    1668              :     }
    1669            0 : }
    1670              : 
    1671              : 
    1672              : void
    1673            0 : AdditionalHandler::parseOverheadWire(const SUMOSAXAttributes& attrs) {
    1674              :     // declare Ok Flag
    1675            0 :     bool parsedOk = true;
    1676              :     // needed attributes
    1677            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1678            0 :     const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
    1679            0 :     const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
    1680              :     // optional attributes
    1681            0 :     const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
    1682            0 :     const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
    1683            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
    1684            0 :     const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
    1685              :     // continue if flag is ok
    1686            0 :     if (parsedOk) {
    1687              :         // set tag
    1688            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_OVERHEAD_WIRE_SECTION);
    1689              :         // add all attributes
    1690            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1691            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_SUBSTATIONID, substationID);
    1692            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_LANES, laneIDs);
    1693            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_STARTPOS, startPos);
    1694            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
    1695            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
    1696            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringListAttribute(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, forbiddenInnerLanes);
    1697              :     }
    1698            0 : }
    1699              : 
    1700              : 
    1701              : void
    1702            0 : AdditionalHandler::parseOverheadWireClamp(const SUMOSAXAttributes& attrs) {
    1703              :     // declare Ok Flag
    1704            0 :     bool parsedOk = true;
    1705              :     // needed attributes
    1706            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1707            0 :     const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
    1708            0 :     const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
    1709            0 :     const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
    1710            0 :     const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
    1711            0 :     const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
    1712              :     // continue if flag is ok
    1713            0 :     if (parsedOk) {
    1714              :         // set tag
    1715            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_OVERHEAD_WIRE_CLAMP);
    1716              :         // add all attributes
    1717            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1718            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_SUBSTATIONID, substationId);
    1719            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, wireClampStart);
    1720            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, wireClampLaneStart);
    1721            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, wireClampEnd);
    1722            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, wireClampLaneEnd);
    1723              :     }
    1724            0 : }
    1725              : 
    1726              : 
    1727              : void
    1728            0 : AdditionalHandler::parsePolyAttributes(const SUMOSAXAttributes& attrs) {
    1729              :     // declare Ok Flag
    1730            0 :     bool parsedOk = true;
    1731              :     // needed attributes
    1732            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1733            0 :     const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
    1734              :     // optional attributes
    1735            0 :     const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
    1736            0 :     const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
    1737            0 :     const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
    1738            0 :     const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
    1739            0 :     const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
    1740            0 :     const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
    1741            0 :     const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
    1742            0 :     const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
    1743            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1744            0 :     const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
    1745              :     // continue if flag is ok
    1746            0 :     if (parsedOk) {
    1747              :         // set tag
    1748            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_POLY);
    1749              :         // add all attributes
    1750            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1751            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionVectorAttribute(SUMO_ATTR_SHAPE, shapeStr);
    1752            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addColorAttribute(SUMO_ATTR_COLOR, color);
    1753            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_GEO, geo);
    1754            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FILL, fill);
    1755            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LINEWIDTH, lineWidth);
    1756            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LAYER, layer);
    1757            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_TYPE, type);
    1758            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_IMGFILE, imgFile);
    1759            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ANGLE, angle);
    1760            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1761            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_RELATIVEPATH, relativePath);
    1762              :     }
    1763            0 : }
    1764              : 
    1765              : 
    1766              : void
    1767            0 : AdditionalHandler::parsePOIAttributes(const SUMOSAXAttributes& attrs) {
    1768              :     // declare Ok Flag
    1769            0 :     bool parsedOk = true;
    1770              :     // check that x and y are defined together
    1771            0 :     if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
    1772            0 :             (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
    1773            0 :         writeError(TL("X and Y must be be defined together in POIs"));
    1774            0 :         parsedOk = false;
    1775              :     }
    1776              :     // check that lane and pos are defined together
    1777            0 :     if ((attrs.hasAttribute(SUMO_ATTR_LANE) && !attrs.hasAttribute(SUMO_ATTR_POSITION)) ||
    1778            0 :             (!attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION))) {
    1779            0 :         writeError(TL("lane and position must be defined together in POIs"));
    1780            0 :         parsedOk = false;
    1781              :     }
    1782              :     // check that lon and lat are defined together
    1783            0 :     if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
    1784            0 :             (!attrs.hasAttribute(SUMO_ATTR_LON) && attrs.hasAttribute(SUMO_ATTR_LAT))) {
    1785            0 :         writeError(TL("lon and lat must be be defined together in POIs"));
    1786            0 :         parsedOk = false;
    1787              :     }
    1788              :     // needed attributes
    1789            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1790              :     // special attributes
    1791            0 :     const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
    1792            0 :     const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
    1793            0 :     const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
    1794            0 :     const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
    1795            0 :     const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
    1796            0 :     const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
    1797            0 :     const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
    1798            0 :     const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
    1799              :     // optional attributes
    1800            0 :     const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
    1801            0 :     const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
    1802            0 :     std::string icon = attrs.getOpt<std::string>(SUMO_ATTR_ICON, "", parsedOk, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE));
    1803            0 :     const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
    1804            0 :     const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
    1805            0 :     const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
    1806            0 :     const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
    1807            0 :     const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
    1808            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1809            0 :     const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
    1810              :     // check icon
    1811            0 :     if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
    1812            0 :         WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
    1813              :         icon = "none";
    1814              :     }
    1815              :     // continue if flag is ok
    1816            0 :     if (parsedOk) {
    1817              :         // set tag
    1818            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(SUMO_TAG_POI);
    1819              :         // add attributes depending of Lane/Lanes
    1820            0 :         if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
    1821            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_X, x);
    1822            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_Y, y);
    1823            0 :         } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
    1824            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_LANE, lane);
    1825            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION, pos);
    1826            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_FRIENDLY_POS, friendlyPos);
    1827            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_POSITION_LAT, posLat);
    1828              :         } else {
    1829            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LON, lon);
    1830            0 :             myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LAT, lat);
    1831              :         }
    1832              :         // add rest attributes
    1833            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1834            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addColorAttribute(SUMO_ATTR_COLOR, color);
    1835            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_TYPE, type);
    1836            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ICON, icon);
    1837            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_LAYER, layer);
    1838            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_IMGFILE, imgFile);
    1839            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_WIDTH, width);
    1840            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_HEIGHT, height);
    1841            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addDoubleAttribute(SUMO_ATTR_ANGLE, angle);
    1842            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1843            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addBoolAttribute(SUMO_ATTR_RELATIVEPATH, relativePath);
    1844              :     }
    1845            0 : }
    1846              : 
    1847              : 
    1848              : void
    1849            0 : AdditionalHandler::parseJpsWalkableAreaAttributes(const SUMOSAXAttributes& attrs) {
    1850              :     // declare Ok Flag
    1851            0 :     bool parsedOk = true;
    1852              :     // needed attributes
    1853            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1854            0 :     const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
    1855              :     // optional attributes
    1856            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1857              :     // continue if flag is ok
    1858            0 :     if (parsedOk) {
    1859              :         // set tag
    1860            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(GNE_TAG_JPS_WALKABLEAREA);
    1861              :         // add all attributes
    1862            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1863            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionVectorAttribute(SUMO_ATTR_SHAPE, shapeStr);
    1864            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1865              :     }
    1866            0 : }
    1867              : 
    1868              : 
    1869              : void
    1870            0 : AdditionalHandler::parseJpsObstacleAttributes(const SUMOSAXAttributes& attrs) {
    1871              :     // declare Ok Flag
    1872            0 :     bool parsedOk = true;
    1873              :     // needed attributes
    1874            0 :     const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
    1875            0 :     const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
    1876              :     // optional attributes
    1877            0 :     const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
    1878              :     // continue if flag is ok
    1879            0 :     if (parsedOk) {
    1880              :         // set tag
    1881            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->setTag(GNE_TAG_JPS_OBSTACLE);
    1882              :         // add all attributes
    1883            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_ID, id);
    1884            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addPositionVectorAttribute(SUMO_ATTR_SHAPE, shapeStr);
    1885            0 :         myCommonXMLStructure.getCurrentSumoBaseObject()->addStringAttribute(SUMO_ATTR_NAME, name);
    1886              :     }
    1887            0 : }
    1888              : 
    1889              : 
    1890              : void
    1891            0 : AdditionalHandler::parseParameters(const SUMOSAXAttributes& attrs) {
    1892              :     // declare Ok Flag
    1893            0 :     bool parsedOk = true;
    1894              :     // get key
    1895            0 :     const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, parsedOk);
    1896              :     // get SumoBaseObject parent
    1897            0 :     CommonXMLStructure::SumoBaseObject* SumoBaseObjectParent = myCommonXMLStructure.getCurrentSumoBaseObject()->getParentSumoBaseObject();
    1898              :     // check parent
    1899            0 :     if (SumoBaseObjectParent == nullptr) {
    1900            0 :         writeError(TL("Parameters must be defined within an object."));
    1901            0 :     } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_ROOTFILE) {
    1902            0 :         writeError(TL("Parameters cannot be defined in the additional file's root."));
    1903            0 :     } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_PARAM) {
    1904            0 :         writeError(TL("Parameters cannot be defined within another parameter."));
    1905            0 :     } else if (parsedOk) {
    1906              :         // get tag str
    1907            0 :         const std::string parentTagStr = toString(SumoBaseObjectParent->getTag());
    1908              :         // circumventing empty string value
    1909            0 :         const std::string value = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
    1910              :         // show warnings if values are invalid
    1911            0 :         if (key.empty()) {
    1912            0 :             WRITE_WARNINGF(TL("Error parsing key from % generic parameter. Key cannot be empty."), parentTagStr);
    1913            0 :         } else if (!SUMOXMLDefinitions::isValidParameterKey(key)) {
    1914            0 :             WRITE_WARNINGF(TL("Error parsing key from % generic parameter. Key contains invalid characters."), parentTagStr);
    1915              :         } else {
    1916            0 :             WRITE_DEBUG("Inserting generic parameter '" + key + "|" + value + "' into " + parentTagStr);
    1917              :             // insert parameter in SumoBaseObjectParent
    1918            0 :             SumoBaseObjectParent->addParameter(key, value);
    1919              :         }
    1920              :     }
    1921            0 : }
    1922              : 
    1923              : 
    1924              : void
    1925            0 : AdditionalHandler::checkParent(const SumoXMLTag currentTag, const std::vector<SumoXMLTag>& parentTags, bool& ok) {
    1926              :     // check that parent SUMOBaseObject's tag is the parentTag
    1927            0 :     CommonXMLStructure::SumoBaseObject* const parent = myCommonXMLStructure.getCurrentSumoBaseObject()->getParentSumoBaseObject();
    1928            0 :     if ((parent != nullptr) &&
    1929            0 :             (parentTags.size() > 0) &&
    1930            0 :             (std::find(parentTags.begin(), parentTags.end(), parent->getTag()) == parentTags.end())) {
    1931            0 :         const std::string id = parent->hasStringAttribute(SUMO_ATTR_ID) ? ", id: '" + parent->getStringAttribute(SUMO_ATTR_ID) + "'" : "";
    1932            0 :         if (id.empty()) {
    1933            0 :             writeError(TLF("'%' must be defined within the definition of a '%'.", toString(currentTag), toString(parentTags.front())));
    1934              :         } else {
    1935            0 :             writeError(TLF("'%' must be defined within the definition of a '%' (found % '%').", toString(currentTag), toString(parentTags.front()), toString(parent->getTag()), id));
    1936              :         }
    1937            0 :         ok = false;
    1938              :     }
    1939            0 : }
    1940              : 
    1941              : 
    1942              : bool
    1943            0 : AdditionalHandler::checkDetectPersons(const SumoXMLTag currentTag, const std::string& id, const std::string& detectPersons) {
    1944            0 :     if (detectPersons.empty() || SUMOXMLDefinitions::PersonModeValues.hasString(detectPersons)) {
    1945            0 :         return true;
    1946              :     } else {
    1947            0 :         writeError(TLF("Attribute '%' defined in % with id '%' doesn't have a valid value (given '%').", toString(SUMO_ATTR_DETECT_PERSONS), toString(currentTag), id, detectPersons));
    1948            0 :         return false;
    1949              :     }
    1950              : }
    1951              : 
    1952              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1