SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NIVissimEdgePosMap.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // -------------------
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 
32 #include <map>
33 #include "NIVissimEdgePosMap.h"
34 
35 #ifdef CHECK_MEMORY_LEAKS
36 #include <foreign/nvwa/debug_new.h>
37 #endif // CHECK_MEMORY_LEAKS
38 
39 
41 
42 
44 
45 
46 void
48  add(edgeid, pos, pos);
49 }
50 
51 
52 void
53 NIVissimEdgePosMap::add(int edgeid, SUMOReal from, SUMOReal to) {
54  if (from > to) {
55  SUMOReal tmp = from;
56  from = to;
57  to = tmp;
58  }
59  ContType::iterator i = myCont.find(edgeid);
60  if (i == myCont.end()) {
61  myCont[edgeid] = Range(from, to);
62  } else {
63  SUMOReal pfrom = (*i).second.first;
64  SUMOReal pto = (*i).second.second;
65  if (pfrom < from) {
66  from = pfrom;
67  }
68  if (pto > to) {
69  to = pto;
70  }
71  myCont[edgeid] = Range(from, to);
72  }
73 }
74 
75 
76 void
78  for (ContType::iterator i = with.myCont.begin(); i != with.myCont.end(); i++) {
79  add((*i).first, (*i).second.first, (*i).second.second);
80  }
81 }
82 
83 
84 
85 /****************************************************************************/
86 
std::pair< SUMOReal, SUMOReal > Range
void add(int edgeid, SUMOReal pos)
#define SUMOReal
Definition: config.h:214
void join(NIVissimEdgePosMap &with)