SUMO - Simulation of Urban MObility
NIVissimExtendedEdgePoint.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
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 
32 #include <netbuild/NBEdge.h>
34 #include "NIVissimEdge.h"
35 
36 
37 // ===========================================================================
38 // method definitions
39 // ===========================================================================
41  int edgeid, const std::vector<int>& lanes, double position,
42  const std::vector<int>& assignedVehicles)
43  : myEdgeID(edgeid), myLanes(lanes), myPosition(position),
44  myAssignedVehicles(assignedVehicles) {}
45 
46 
48 
49 
50 int
52  return myEdgeID;
53 }
54 
55 
56 double
58  return myPosition;
59 }
60 
61 
64  return
66 }
67 
68 
69 const std::vector<int>&
71  return myLanes;
72 }
73 
74 
75 void
77  // check whether an "all" indicator is there
78  bool hadAll = false;
79  for (std::vector<int>::const_iterator i = myLanes.begin(); !hadAll && i != myLanes.end(); ++i) {
80  if ((*i) == -1) {
81  hadAll = true;
82  }
83  }
84  // no -> return
85  if (!hadAll) {
86  return;
87  }
88  // patch lane indices
89  myLanes.clear();
90  for (int i = 0; i < (int) edge->getNumLanes(); ++i) {
91  myLanes.push_back(i);
92  }
93 }
94 
95 
96 /****************************************************************************/
97 
static bool dictionary(int id, NIVissimAbstractEdge *e)
void recheckLanes(const NBEdge *const edge)
Resets lane numbers if all lanes shall be used.
The representation of a single edge during network building.
Definition: NBEdge.h:70
NIVissimExtendedEdgePoint(int edgeid, const std::vector< int > &lanes, double position, const std::vector< int > &assignedVehicles)
Constructor.
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:412
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
const std::vector< int > & getLanes() const