Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netload/NLNetShapeHandler.h
169666 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 NLNetShapeHandler.h
15
/// @author Jakob Erdmann
16
/// @date Sept 2022
17
///
18
// The XML-Handler for loading secondary network shapes
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/xml/SUMOSAXHandler.h>
24
25
// ===========================================================================
26
// class declarations
27
// ===========================================================================
28
29
30
// ===========================================================================
31
// class definitions
32
// ===========================================================================
33
34
35
/**
36
* @class NLNetShapeHandler
37
* @brief The XML-Handler for network loading
38
*
39
* The SAX2-handler responsible for parsing networks and routes to load.
40
* This is an extension of the MSRouteHandler as routes and vehicles may also
41
* be loaded from network descriptions.
42
*/
43
class NLNetShapeHandler : public SUMOSAXHandler {
44
45
public:
46
/** @brief Constructor
47
*
48
* @param[in] file Name of the parsed file
49
* @param[in, out] net The network to fill
50
*/
51
NLNetShapeHandler(const std::string& file, MSNet& net);
52
53
54
/// @brief Destructor
55
virtual ~NLNetShapeHandler();
56
57
/// @brief resolve mismatch between internal lane ids of both networks
58
void sortInternalShapes();
59
60
protected:
61
/// @name inherited from GenericSAXHandler
62
//@{
63
64
/** @brief Called on the opening of a tag;
65
*
66
* @param[in] element ID of the currently opened element
67
* @param[in] attrs Attributes within the currently opened element
68
* @exception ProcessError If something fails
69
* @see GenericSAXHandler::myStartElement
70
* @todo Refactor/describe
71
*/
72
virtual void myStartElement(int element,
73
const SUMOSAXAttributes& attrs);
74
75
//@}
76
77
78
private:
79
80
/// adds a secondary lane shape
81
void addLane(const SUMOSAXAttributes& attrs);
82
83
/// adds a junction position
84
void addJunction(const SUMOSAXAttributes& attrs);
85
86
/// records connection topology for later resorting
87
void addConnection(const SUMOSAXAttributes& attrs);
88
89
protected:
90
/// @brief The net to fill (preinitialised)
91
MSNet& myNet;
92
93
/// @brief mapping between primary internal lane and corresponding secondary internal lane
94
std::map<const MSJunction*, std::map<MSLane*, MSLane*> > myShuffledJunctions;
95
96
/// @brief lanes of the primary network that should receive a secondary shape
97
std::set<const MSEdge*> myPrimaryEdges;
98
99
private:
100
/** invalid copy constructor */
101
NLNetShapeHandler(const NLNetShapeHandler& s);
102
103
/** invalid assignment operator */
104
NLNetShapeHandler& operator=(const NLNetShapeHandler& s);
105
106
};
107
108