SUMO - Simulation of Urban MObility
AGPosition.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-2018 German Aerospace Center (DLR) and others.
4 // activitygen module
5 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
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 // SPDX-License-Identifier: EPL-2.0
11 /****************************************************************************/
20 // References a street of the city and defines a position in this street
21 /****************************************************************************/
22 #ifndef AGPOSITION_H
23 #define AGPOSITION_H
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #include <config.h>
30 
31 #include "../../utils/geom/Position.h"
32 #include <list>
33 #include <map>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class AGStreet;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
56 class AGPosition {
57 public:
67  AGPosition(const AGStreet& str, double pos);
75  AGPosition(const AGStreet& str);
76 
81  const AGStreet& getStreet() const;
82 
90  double getPosition() const;
91 
100  bool operator==(const AGPosition& pos) const;
101 
107  double distanceTo(const AGPosition& otherPos) const;
108 
117  double minDistanceTo(const std::list<AGPosition>& positions) const;
118 
127  double minDistanceTo(const std::map<int, AGPosition>& positions) const;
128 
132  void print() const;
133 
134 private:
135  const AGStreet* street;
136  double position;
138 
143  static double randomPositionInStreet(const AGStreet& street);
144 
152  Position compute2dPosition() const;
153 };
154 
155 #endif /* AGPOSITION_H */
156 
157 /****************************************************************************/
Position compute2dPosition() const
Definition: AGPosition.cpp:119
static double randomPositionInStreet(const AGStreet &street)
Determines a random relative position on a street.
Definition: AGPosition.cpp:113
A location in the 2D plane freely positioned on a street.
Definition: AGPosition.h:56
A model of the street in the city.
Definition: AGStreet.h:53
bool operator==(const AGPosition &pos) const
Tests whether two positions are at the same place.
Definition: AGPosition.cpp:57
AGPosition(const AGStreet &str, double pos)
Constructs an AGPosition at a certain point on a street.
Definition: AGPosition.cpp:40
double minDistanceTo(const std::list< AGPosition > &positions) const
Computes the distance to the closest position in a list.
Definition: AGPosition.cpp:69
const AGStreet & getStreet() const
Provides the street this AGPosition is located on.
Definition: AGPosition.cpp:101
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
double distanceTo(const AGPosition &otherPos) const
Computes the distance between two AGPosition objects.
Definition: AGPosition.cpp:63
Position pos2d
Definition: AGPosition.h:137
void print() const
Prints out a summary of the properties of this class on standard output.
Definition: AGPosition.cpp:51
double getPosition() const
Provides the relative position of this AGPosition on the street.
Definition: AGPosition.cpp:107
double position
Definition: AGPosition.h:136
const AGStreet * street
Definition: AGPosition.h:135