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.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // -------------------
20 /****************************************************************************/
21 #include <config.h>
22 
24 #include <netbuild/NBEdge.h>
26 #include "NIVissimEdge.h"
27 
28 
29 // ===========================================================================
30 // method definitions
31 // ===========================================================================
33  int edgeid, const std::vector<int>& lanes, double position,
34  const std::vector<int>& assignedVehicles)
35  : myEdgeID(edgeid), myLanes(lanes), myPosition(position),
36  myAssignedVehicles(assignedVehicles) {}
37 
38 
40 
41 
42 int
44  return myEdgeID;
45 }
46 
47 
48 double
50  return myPosition;
51 }
52 
53 
56  return
58 }
59 
60 
61 const std::vector<int>&
63  return myLanes;
64 }
65 
66 
67 void
69  // check whether an "all" indicator is there
70  bool hadAll = false;
71  for (std::vector<int>::const_iterator i = myLanes.begin(); !hadAll && i != myLanes.end(); ++i) {
72  if ((*i) == -1) {
73  hadAll = true;
74  }
75  }
76  // no -> return
77  if (!hadAll) {
78  return;
79  }
80  // patch lane indices
81  myLanes.clear();
82  for (int i = 0; i < (int) edge->getNumLanes(); ++i) {
83  myLanes.push_back(i);
84  }
85 }
86 
87 
88 /****************************************************************************/
The representation of a single edge during network building.
Definition: NBEdge.h:92
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:516
static bool dictionary(int id, NIVissimAbstractEdge *e)
void recheckLanes(const NBEdge *const edge)
Resets lane numbers if all lanes shall be used.
const std::vector< int > & getLanes() const
NIVissimExtendedEdgePoint(int edgeid, const std::vector< int > &lanes, double position, const std::vector< int > &assignedVehicles)
Constructor.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37