LCOV - code coverage report
Current view: top level - src/netimport/vissim/typeloader - NIVissimSingleTypeParser_Parkplatzdefinition.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 3 36 8.3 %
Date: 2024-05-01 15:34:42 Functions: 3 4 75.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    NIVissimSingleTypeParser_Parkplatzdefinition.cpp
      15             : /// @author  Daniel Krajzewicz
      16             : /// @author  Michael Behrisch
      17             : /// @date    Wed, 18 Dec 2002
      18             : ///
      19             : //
      20             : /****************************************************************************/
      21             : #include <config.h>
      22             : 
      23             : #include <iostream>
      24             : #include <vector>
      25             : #include <utility>
      26             : #include <utils/common/StringUtils.h>
      27             : #include <utils/common/ToString.h>
      28             : #include <utils/common/VectorHelper.h>
      29             : #include <netbuild/NBDistrictCont.h>
      30             : #include <netbuild/NBDistrict.h>
      31             : #include <netbuild/NBNode.h>
      32             : #include <netbuild/NBNodeCont.h>
      33             : #include <netimport/vissim/NIImporter_Vissim.h>
      34             : #include <netimport/vissim/tempstructs/NIVissimDistrictConnection.h>
      35             : #include "NIVissimSingleTypeParser_Parkplatzdefinition.h"
      36             : 
      37             : 
      38             : // ===========================================================================
      39             : // method definitions
      40             : // ===========================================================================
      41           9 : NIVissimSingleTypeParser_Parkplatzdefinition::NIVissimSingleTypeParser_Parkplatzdefinition(NIImporter_Vissim& parent)
      42           9 :     : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
      43             : 
      44             : 
      45          18 : NIVissimSingleTypeParser_Parkplatzdefinition::~NIVissimSingleTypeParser_Parkplatzdefinition() {}
      46             : 
      47             : 
      48             : bool
      49           0 : NIVissimSingleTypeParser_Parkplatzdefinition::parse(std::istream& from) {
      50             :     int id;
      51           0 :     from >> id;
      52             : 
      53             :     std::string tag;
      54           0 :     from >> tag;
      55           0 :     std::string name = readName(from);
      56             : 
      57             :     // parse the districts
      58             :     //  and allocate them if not done before
      59             :     //  A district may be already saved when another parking place with
      60             :     //  the same district was already build.
      61             :     std::vector<int> districts;
      62             :     std::vector<double> percentages;
      63           0 :     readUntil(from, "bezirke"); // "Bezirke"
      64           0 :     while (tag != "ort") {
      65           0 :         double perc = -1;
      66             :         int districtid;
      67           0 :         from >> districtid;
      68           0 :         tag = myRead(from);
      69           0 :         if (tag == "anteil") {
      70             :             from >> perc;
      71             :         }
      72           0 :         districts.push_back(districtid);
      73           0 :         percentages.push_back(perc);
      74           0 :         tag = myRead(from);
      75             :     }
      76             : 
      77           0 :     from >> tag; // "Strecke"
      78             :     int edgeid;
      79           0 :     from >> edgeid;
      80             : 
      81             :     double position;
      82           0 :     from >> tag; // "bei"
      83             :     from >> position;
      84             : 
      85             :     double length;
      86           0 :     from >> tag;
      87             :     from >> length;
      88             : 
      89           0 :     from >> tag; // "Kapazitaet"
      90           0 :     from >> tag; // "Kapazitaet"-value
      91             : 
      92           0 :     tag = myRead(from);
      93           0 :     if (tag == "belegung") {
      94           0 :         from >> tag;
      95           0 :         tag = myRead(from); // "fahrzeugklasse"
      96             :     }
      97             : 
      98             :     std::vector<std::pair<int, int> > assignedVehicles;
      99           0 :     while (tag != "default") {
     100             :         int vclass;
     101           0 :         from >> vclass;
     102           0 :         from >> tag; // "vwunsch"
     103             :         int vwunsch;
     104           0 :         from >> vwunsch; // "vwunsch"-value
     105           0 :         assignedVehicles.push_back(std::pair<int, int>(vclass, vwunsch));
     106           0 :         tag = myRead(from);
     107             :     }
     108             : 
     109           0 :     from >> tag;
     110           0 :     from >> tag;
     111             : //    NIVissimEdge *e = NIVissimEdge::dictionary(edgeid);
     112             : //    e->addReferencedDistrict(id);
     113             : 
     114             :     // build the district connection
     115           0 :     return NIVissimDistrictConnection::dictionary(id, name,
     116           0 :             districts, percentages, edgeid, position, assignedVehicles);
     117             : }
     118             : 
     119             : 
     120             : /****************************************************************************/

Generated by: LCOV version 1.14