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 /****************************************************************************/
17 // Some mathematical helper methods
18 /****************************************************************************/
19 #ifndef NBHelpers_h
20 #define NBHelpers_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <set>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class NBNode;
36 class Position;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
46 class NBHelpers {
47 public:
49  static double relAngle(double angle1, double angle2);
50 
52  static double normRelAngle(double angle1, double angle2);
53 
55  static std::string normalIDRepresentation(const std::string& id);
56 
58  static double distance(NBNode* node1, NBNode* node2);
59 
61  static void loadEdgesFromFile(const std::string& file, std::set<std::string>& into);
62 
64  static void loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set<std::string>& into);
65 
71  static void interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index);
72 };
73 
74 
75 #endif
76 
77 /****************************************************************************/
78 
NBHelpers::normalIDRepresentation
static std::string normalIDRepresentation(const std::string &id)
converts the numerical id to its "normal" string representation
Definition: NBHelpers.cpp:70
NBHelpers::normRelAngle
static double normRelAngle(double angle1, double angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
Definition: NBHelpers.cpp:59
NBHelpers::relAngle
static double relAngle(double angle1, double angle2)
computes the relative angle between the two angles
Definition: NBHelpers.cpp:46
NBHelpers
Definition: NBHelpers.h:46
NBHelpers::loadPrefixedIDsFomFile
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:105
NBHelpers::distance
static double distance(NBNode *node1, NBNode *node2)
returns the distance between both nodes
Definition: NBHelpers.cpp:81
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
NBHelpers::interpretLaneID
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:120
config.h
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NBHelpers::loadEdgesFromFile
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:87