Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
FlippedNode.h
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/****************************************************************************/
18// Wrapper around an RONode used for backward search. It swaps incoming
19// with outgoing edges, and replaces the original edges by reversed
20// ones (i.e., by instances of FlippedEdge)
21/****************************************************************************/
22#pragma once
23#include <config.h>
24#include <vector>
25#include "FlippedEdge.h"
26
27// ===========================================================================
28// class definitions
29// ===========================================================================
31template<class E, class N, class V>
33public:
34 typedef std::vector<const FlippedEdge<E, N, V>*> ConstFlippedEdgeVector;
35
39 FlippedNode(const N* originalNode) :
40 myOriginalNode(originalNode) {}
41
44
48 const Position& getPosition() const {
49 return myOriginalNode->getPosition();
50 }
54 const std::string& getID() const {
55 return myOriginalNode->getID();
56 }
57
62 if (myIncoming.empty()) {
63 const std::vector<const E*>& incoming = myOriginalNode->getOutgoing();
64 for (const E* edge : incoming) {
65 myIncoming.push_back(edge->getFlippedRoutingEdge());
66 }
67 }
68 return myIncoming;
69 }
70
75 if (myOutgoing.empty()) {
76 const std::vector<const E*>& outgoing = myOriginalNode->getIncoming();
77 for (const E* edge : outgoing) {
78 myOutgoing.push_back(edge->getFlippedRoutingEdge());
79 }
80 }
81 return myOutgoing;
82 }
83
85 const N* getOriginalNode() const {
86 return myOriginalNode;
87 }
88private:
90 const N* const myOriginalNode;
95};
the node type representing nodes used for backward search
Definition FlippedNode.h:32
const N *const myOriginalNode
The original node.
Definition FlippedNode.h:90
const ConstFlippedEdgeVector & getIncoming() const
Returns the incoming edges of the node.
Definition FlippedNode.h:61
FlippedNode(const N *originalNode)
Definition FlippedNode.h:39
~FlippedNode()
Destructor.
Definition FlippedNode.h:43
const N * getOriginalNode() const
Returns the original node.
Definition FlippedNode.h:85
const Position & getPosition() const
Returns the position of the node.
Definition FlippedNode.h:48
const std::string & getID() const
Returns the id(entifier) of the node.
Definition FlippedNode.h:54
std::vector< const FlippedEdge< E, N, V > * > ConstFlippedEdgeVector
Definition FlippedNode.h:34
ConstFlippedEdgeVector myOutgoing
The outgoing edges.
Definition FlippedNode.h:94
const ConstFlippedEdgeVector & getOutgoing() const
Returns the outgoing edges of the node.
Definition FlippedNode.h:74
ConstFlippedEdgeVector myIncoming
The incoming edges.
Definition FlippedNode.h:92
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37