SUMO - Simulation of Urban MObility
AGPosition.h
Go to the documentation of this file.
00001 /****************************************************************************/
00010 // References a street of the city and defines a position in this street
00011 /****************************************************************************/
00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00014 // activitygen module
00015 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
00016 /****************************************************************************/
00017 //
00018 //   This file is part of SUMO.
00019 //   SUMO is free software: you can redistribute it and/or modify
00020 //   it under the terms of the GNU General Public License as published by
00021 //   the Free Software Foundation, either version 3 of the License, or
00022 //   (at your option) any later version.
00023 //
00024 /****************************************************************************/
00025 #ifndef AGPOSITION_H
00026 #define AGPOSITION_H
00027 
00028 
00029 // ===========================================================================
00030 // included modules
00031 // ===========================================================================
00032 #ifdef _MSC_VER
00033 #include <windows_config.h>
00034 #else
00035 #include <config.h>
00036 #endif
00037 
00038 #include "../../utils/geom/Position.h"
00039 #include <list>
00040 #include <map>
00041 
00042 
00043 // ===========================================================================
00044 // class declarations
00045 // ===========================================================================
00046 class AGStreet;
00047 
00048 
00049 // ===========================================================================
00050 // class definitions
00051 // ===========================================================================
00063 class AGPosition {
00064 public:
00074     AGPosition(const AGStreet& str, SUMOReal pos) ;
00082     AGPosition(const AGStreet& str) ;
00083 
00088     const AGStreet& getStreet() const ;
00089 
00097     SUMOReal getPosition() const ;
00098 
00107     bool operator==(const AGPosition& pos) const ;
00108 
00114     SUMOReal distanceTo(const AGPosition& otherPos) const ;
00115 
00124     SUMOReal minDistanceTo(const std::list<AGPosition>& positions) const ;
00125 
00134     SUMOReal minDistanceTo(const std::map<int, AGPosition>& positions) const ;
00135 
00139     void print() const ;
00140 
00141 private:
00142     const AGStreet* street;
00143     SUMOReal position;
00144     Position pos2d;
00145 
00150     static SUMOReal randomPositionInStreet(const AGStreet& street) ;
00151 
00159     Position compute2dPosition() const ;
00160 };
00161 
00162 #endif /* AGPOSITION_H */
00163 
00164 /****************************************************************************/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines