Eclipse SUMO - Simulation of Urban MObility
NBHelpers.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Some mathematical helper methods
19 /****************************************************************************/
20 #ifndef NBHelpers_h
21 #define NBHelpers_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <set>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class NBNode;
37 class Position;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
47 class NBHelpers {
48 public:
50  static double relAngle(double angle1, double angle2);
51 
53  static double normRelAngle(double angle1, double angle2);
54 
56  static std::string normalIDRepresentation(const std::string& id);
57 
59  static double distance(NBNode* node1, NBNode* node2);
60 
62  static void loadEdgesFromFile(const std::string& file, std::set<std::string>& into);
63 
65  static void loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set<std::string>& into);
66 
72  static void interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index);
73 };
74 
75 
76 #endif
77 
78 /****************************************************************************/
79 
static double relAngle(double angle1, double angle2)
computes the relative angle between the two angles
Definition: NBHelpers.cpp:47
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
Definition: NBHelpers.cpp:106
static double normRelAngle(double angle1, double angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
Definition: NBHelpers.cpp:60
static void loadEdgesFromFile(const std::string &file, std::set< std::string > &into)
Add edge ids defined in file (either ID or edge:ID per line) into the given set.
Definition: NBHelpers.cpp:88
static std::string normalIDRepresentation(const std::string &id)
converts the numerical id to its "normal" string representation
Definition: NBHelpers.cpp:71
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
static double distance(NBNode *node1, NBNode *node2)
returns the distance between both nodes
Definition: NBHelpers.cpp:82
static void interpretLaneID(const std::string &lane_id, std::string &edge_id, int &index)
parses edge-id and index from lane-id
Definition: NBHelpers.cpp:121
Represents a single node (junction) during network building.
Definition: NBNode.h:68