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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // Some mathematical helper methods
21 /****************************************************************************/
22 #ifndef NBHelpers_h
23 #define NBHelpers_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <set>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class NBNode;
43 class Position;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
53 class NBHelpers {
54 public:
56  static double relAngle(double angle1, double angle2);
57 
59  static double normRelAngle(double angle1, double angle2);
60 
62  static std::string normalIDRepresentation(const std::string& id);
63 
65  static double distance(NBNode* node1, NBNode* node2);
66 
68  static void loadEdgesFromFile(const std::string& file, std::set<std::string>& into);
69 
71  static void loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set<std::string>& into);
72 
78  static void interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index);
79 };
80 
81 
82 #endif
83 
84 /****************************************************************************/
85 
static double relAngle(double angle1, double angle2)
computes the relative angle between the two angles
Definition: NBHelpers.cpp:53
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:112
static double normRelAngle(double angle1, double angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
Definition: NBHelpers.cpp:66
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:94
static std::string normalIDRepresentation(const std::string &id)
converts the numerical id to its "normal" string representation
Definition: NBHelpers.cpp:77
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
static double distance(NBNode *node1, NBNode *node2)
returns the distance between both nodes
Definition: NBHelpers.cpp:88
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:127
Represents a single node (junction) during network building.
Definition: NBNode.h:74