Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netimport/vissim/tempstructs/NIVissimConnection.h
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 NIVissimConnection.h
15
/// @author Daniel Krajzewicz
16
/// @author Michael Behrisch
17
/// @date Sept 2002
18
///
19
// -------------------
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <string>
25
#include <map>
26
#include "NIVissimExtendedEdgePoint.h"
27
#include <utils/geom/Position.h>
28
#include <utils/geom/AbstractPoly.h>
29
#include "NIVissimAbstractEdge.h"
30
#include "NIVissimClosedLanesVector.h"
31
#include "NIVissimBoundedClusterObject.h"
32
33
34
// ===========================================================================
35
// class declarations
36
// ===========================================================================
37
class NBEdgeCont;
38
39
40
// ===========================================================================
41
// class definitions
42
// ===========================================================================
43
class NIVissimConnection
44
: public NIVissimBoundedClusterObject,
45
public NIVissimAbstractEdge {
46
public:
47
/* enum Direction {
48
NIVC_DIR_RIGHT,
49
NIVC_DIR_LEFT,
50
NIVC_DIR_ALL
51
}; */
52
53
NIVissimConnection(int id, const std::string& name,
54
const NIVissimExtendedEdgePoint& from_def,
55
const NIVissimExtendedEdgePoint& to_def,
56
const PositionVector& geom,
57
const std::vector<int>& assignedVehicles,
58
const NIVissimClosedLanesVector& clv);
59
virtual ~NIVissimConnection();
60
void computeBounding();
61
int getFromEdgeID() const;
62
int getToEdgeID() const;
63
double getFromPosition() const;
64
double getToPosition() const;
65
Position getFromGeomPosition() const;
66
Position getToGeomPosition() const;
67
void setNodeCluster(int nodeid);
68
const Boundary& getBoundingBox() const;
69
70
int buildEdgeConnections(NBEdgeCont& ec);
71
72
void buildGeom();
73
74
75
/** @brief Resets lane numbers if all lanes shall be used
76
*
77
* Calls "NIVissimExtendedEdgePoint::recheckLanes" for both used
78
* edges.
79
*
80
* @param[in] The built from-edge
81
* @param[in] The built to-edge
82
*/
83
void recheckLanes(const NBEdge* const fromEdge, const NBEdge* const toEdge);
84
85
public:
86
const std::vector<int>& getFromLanes() const;
87
const std::vector<int>& getToLanes() const;
88
89
90
91
static bool dictionary(int id, NIVissimConnection* o);
92
static NIVissimConnection* dictionary(int id);
93
static std::vector<int> getWithin(const AbstractPoly& poly);
94
static void buildNodeClusters();
95
static std::vector<int> getForEdge(int edgeid, bool omitNodeAssigned = true);
96
static void dict_buildNBEdgeConnections(NBEdgeCont& ec);
97
static void dict_assignToEdges();
98
static int getMaxID();
99
100
private:
101
std::string myName;
102
NIVissimExtendedEdgePoint myFromDef, myToDef;
103
std::vector<int> myAssignedVehicles;
104
NIVissimClosedLanesVector myClosedLanes;
105
private:
106
typedef std::map<int, NIVissimConnection*> DictType;
107
static DictType myDict;
108
static int myMaxID;
109
};
110
111