SUMO - Simulation of Urban MObility
AGPosition.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // References a street of the city and defines a position in this street
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
14 // activitygen module
15 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
16 /****************************************************************************/
17 //
18 // This file is part of SUMO.
19 // SUMO is free software: you can redistribute it and/or modify
20 // it under the terms of the GNU General Public License as published by
21 // the Free Software Foundation, either version 3 of the License, or
22 // (at your option) any later version.
23 //
24 /****************************************************************************/
25 #ifndef AGPOSITION_H
26 #define AGPOSITION_H
27 
28 
29 // ===========================================================================
30 // included modules
31 // ===========================================================================
32 #ifdef _MSC_VER
33 #include <windows_config.h>
34 #else
35 #include <config.h>
36 #endif
37 
38 #include "../../utils/geom/Position.h"
39 #include <list>
40 #include <map>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class AGStreet;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
63 class AGPosition {
64 public:
74  AGPosition(const AGStreet& str, SUMOReal pos);
82  AGPosition(const AGStreet& str);
83 
88  const AGStreet& getStreet() const;
89 
97  SUMOReal getPosition() const;
98 
107  bool operator==(const AGPosition& pos) const;
108 
114  SUMOReal distanceTo(const AGPosition& otherPos) const;
115 
124  SUMOReal minDistanceTo(const std::list<AGPosition>& positions) const;
125 
134  SUMOReal minDistanceTo(const std::map<int, AGPosition>& positions) const;
135 
139  void print() const;
140 
141 private:
142  const AGStreet* street;
145 
150  static SUMOReal randomPositionInStreet(const AGStreet& street);
151 
159  Position compute2dPosition() const;
160 };
161 
162 #endif /* AGPOSITION_H */
163 
164 /****************************************************************************/
void print() const
Prints out a summary of the properties of this class on standard output.
Definition: AGPosition.cpp:58
const AGStreet & getStreet() const
Provides the street this AGPosition is located on.
Definition: AGPosition.cpp:108
A location in the 2D plane freely positioned on a street.
Definition: AGPosition.h:63
A model of the street in the city.
Definition: AGStreet.h:60
SUMOReal position
Definition: AGPosition.h:143
SUMOReal getPosition() const
Provides the relative position of this AGPosition on the street.
Definition: AGPosition.cpp:114
bool operator==(const AGPosition &pos) const
Tests whether two positions are at the same place.
Definition: AGPosition.cpp:64
AGPosition(const AGStreet &str, SUMOReal pos)
Constructs an AGPosition at a certain point on a street.
Definition: AGPosition.cpp:47
Position compute2dPosition() const
Definition: AGPosition.cpp:126
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
SUMOReal minDistanceTo(const std::list< AGPosition > &positions) const
Computes the distance to the closest position in a list.
Definition: AGPosition.cpp:76
Position pos2d
Definition: AGPosition.h:144
static SUMOReal randomPositionInStreet(const AGStreet &street)
Determines a random relative position on a street.
Definition: AGPosition.cpp:120
SUMOReal distanceTo(const AGPosition &otherPos) const
Computes the distance between two AGPosition objects.
Definition: AGPosition.cpp:70
#define SUMOReal
Definition: config.h:214
const AGStreet * street
Definition: AGPosition.h:142