Eclipse 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-2019 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 /****************************************************************************/
15 // -------------------
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
25 #include <netbuild/NBEdge.h>
27 #include "NIVissimEdge.h"
28 
29 
30 // ===========================================================================
31 // method definitions
32 // ===========================================================================
34  int edgeid, const std::vector<int>& lanes, double position,
35  const std::vector<int>& assignedVehicles)
36  : myEdgeID(edgeid), myLanes(lanes), myPosition(position),
37  myAssignedVehicles(assignedVehicles) {}
38 
39 
41 
42 
43 int
45  return myEdgeID;
46 }
47 
48 
49 double
51  return myPosition;
52 }
53 
54 
57  return
59 }
60 
61 
62 const std::vector<int>&
64  return myLanes;
65 }
66 
67 
68 void
70  // check whether an "all" indicator is there
71  bool hadAll = false;
72  for (std::vector<int>::const_iterator i = myLanes.begin(); !hadAll && i != myLanes.end(); ++i) {
73  if ((*i) == -1) {
74  hadAll = true;
75  }
76  }
77  // no -> return
78  if (!hadAll) {
79  return;
80  }
81  // patch lane indices
82  myLanes.clear();
83  for (int i = 0; i < (int) edge->getNumLanes(); ++i) {
84  myLanes.push_back(i);
85  }
86 }
87 
88 
89 /****************************************************************************/
90 
NIVissimEdge.h
NIVissimExtendedEdgePoint::NIVissimExtendedEdgePoint
NIVissimExtendedEdgePoint(int edgeid, const std::vector< int > &lanes, double position, const std::vector< int > &assignedVehicles)
Constructor.
Definition: NIVissimExtendedEdgePoint.cpp:33
NIVissimExtendedEdgePoint::getLanes
const std::vector< int > & getLanes() const
Definition: NIVissimExtendedEdgePoint.cpp:63
NIVissimExtendedEdgePoint::myLanes
std::vector< int > myLanes
Definition: NIVissimExtendedEdgePoint.h:70
NIVissimExtendedEdgePoint::getEdgeID
int getEdgeID() const
Definition: NIVissimExtendedEdgePoint.cpp:44
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
VectorHelper.h
NIVissimExtendedEdgePoint::~NIVissimExtendedEdgePoint
~NIVissimExtendedEdgePoint()
Definition: NIVissimExtendedEdgePoint.cpp:40
NBEdge::getNumLanes
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:477
NIVissimExtendedEdgePoint::myPosition
double myPosition
Definition: NIVissimExtendedEdgePoint.h:71
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
NIVissimAbstractEdge::dictionary
static bool dictionary(int id, NIVissimAbstractEdge *e)
Definition: NIVissimAbstractEdge.cpp:58
NIVissimExtendedEdgePoint::recheckLanes
void recheckLanes(const NBEdge *const edge)
Resets lane numbers if all lanes shall be used.
Definition: NIVissimExtendedEdgePoint.cpp:69
NIVissimExtendedEdgePoint.h
NIVissimExtendedEdgePoint::getGeomPosition
Position getGeomPosition() const
Definition: NIVissimExtendedEdgePoint.cpp:56
config.h
NIVissimExtendedEdgePoint::myEdgeID
int myEdgeID
Definition: NIVissimExtendedEdgePoint.h:69
NIVissimExtendedEdgePoint::getPosition
double getPosition() const
Definition: NIVissimExtendedEdgePoint.cpp:50
NBEdge.h