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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // -------------------
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
26 #include <netbuild/NBEdge.h>
28 #include "NIVissimEdge.h"
29 
30 
31 // ===========================================================================
32 // method definitions
33 // ===========================================================================
35  int edgeid, const std::vector<int>& lanes, double position,
36  const std::vector<int>& assignedVehicles)
37  : myEdgeID(edgeid), myLanes(lanes), myPosition(position),
38  myAssignedVehicles(assignedVehicles) {}
39 
40 
42 
43 
44 int
46  return myEdgeID;
47 }
48 
49 
50 double
52  return myPosition;
53 }
54 
55 
58  return
60 }
61 
62 
63 const std::vector<int>&
65  return myLanes;
66 }
67 
68 
69 void
71  // check whether an "all" indicator is there
72  bool hadAll = false;
73  for (std::vector<int>::const_iterator i = myLanes.begin(); !hadAll && i != myLanes.end(); ++i) {
74  if ((*i) == -1) {
75  hadAll = true;
76  }
77  }
78  // no -> return
79  if (!hadAll) {
80  return;
81  }
82  // patch lane indices
83  myLanes.clear();
84  for (int i = 0; i < (int) edge->getNumLanes(); ++i) {
85  myLanes.push_back(i);
86  }
87 }
88 
89 
90 /****************************************************************************/
91 
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:65
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:420
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
const std::vector< int > & getLanes() const