SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimSingleTypeParser_Knotendefinition.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 //
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <iostream>
34 #include <utils/geom/Position.h>
36 #include "../NIImporter_Vissim.h"
37 #include "../tempstructs/NIVissimNodeParticipatingEdge.h"
38 #include "../tempstructs/NIVissimNodeParticipatingEdgeVector.h"
39 #include "../tempstructs/NIVissimNodeDef_Edges.h"
40 #include "../tempstructs/NIVissimNodeDef_Poly.h"
41 #include "../tempstructs/NIVissimNodeDef.h"
43 
44 #ifdef CHECK_MEMORY_LEAKS
45 #include <foreign/nvwa/debug_new.h>
46 #endif // CHECK_MEMORY_LEAKS
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
53  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
54 
55 
57 
58 
59 bool
61  //
62  int id;
63  from >> id;
64  //
65  std::string tag;
66  from >> tag;
67  std::string name = readName(from);
68  //
69  tag = overrideOptionalLabel(from);
70  //
71  while (tag != "netzausschnitt") {
72  tag = myRead(from);
73  }
74  //
75  tag = myRead(from);
76  if (tag == "strecke") {
78  while (tag == "strecke") {
79  int edgeid;
80  SUMOReal from_pos, to_pos;
81  from_pos = to_pos = -1.0;
82  from >> edgeid;
83  tag = readEndSecure(from, "strecke");
84  if (tag == "von") {
85  from >> from_pos; // type-checking is missing!
86  from >> tag;
87  from >> to_pos; // type-checking is missing!
88  tag = readEndSecure(from, "strecke");
89  }
90  edges.push_back(new NIVissimNodeParticipatingEdge(edgeid, from_pos, to_pos));
91  }
92  NIVissimNodeDef_Edges::dictionary(id, name, edges);
93  } else {
94  int no = TplConvert::_2int(tag.c_str());
95  PositionVector poly;
96  for (int i = 0; i < no; i++) {
97  poly.push_back(getPosition(from));
98  }
99  poly.closePolygon();
100  NIVissimNodeDef_Poly::dictionary(id, name, poly);
101  }
102  return true;
103 }
104 
105 
106 
107 /****************************************************************************/
108