Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.cpp
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file NIVissimExtendedEdgePoint.cpp
15
/// @author Daniel Krajzewicz
16
/// @author Michael Behrisch
17
/// @date Sept 2002
18
///
19
// -------------------
20
/****************************************************************************/
21
#include <config.h>
22
23
#include <utils/common/VectorHelper.h>
24
#include <netbuild/NBEdge.h>
25
#include "NIVissimExtendedEdgePoint.h"
26
#include "NIVissimEdge.h"
27
28
29
// ===========================================================================
30
// method definitions
31
// ===========================================================================
32
NIVissimExtendedEdgePoint::NIVissimExtendedEdgePoint(
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
39
NIVissimExtendedEdgePoint::~NIVissimExtendedEdgePoint() {}
40
41
42
int
43
NIVissimExtendedEdgePoint::getEdgeID() const {
44
return myEdgeID;
45
}
46
47
48
double
49
NIVissimExtendedEdgePoint::getPosition() const {
50
return myPosition;
51
}
52
53
54
Position
55
NIVissimExtendedEdgePoint::getGeomPosition() const {
56
return
57
NIVissimAbstractEdge::dictionary(myEdgeID)->getGeomPosition(myPosition);
58
}
59
60
61
const std::vector<int>&
62
NIVissimExtendedEdgePoint::getLanes() const {
63
return myLanes;
64
}
65
66
67
void
68
NIVissimExtendedEdgePoint::recheckLanes(const NBEdge* const edge) {
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
/****************************************************************************/
89
90