SUMO - Simulation of Urban MObility

NIVissimTL.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // -------------------
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef NIVissimTL_h
00020 #define NIVissimTL_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 
00033 #include <map>
00034 #include <string>
00035 #include <vector>
00036 #include <utils/geom/PositionVector.h>
00037 #include <utils/geom/AbstractPoly.h>
00038 #include <utils/common/VectorHelper.h>
00039 #include <utils/common/SUMOTime.h>
00040 
00041 
00042 class NBTrafficLightLogicCont;
00043 
00044 
00045 
00046 // ===========================================================================
00047 // class declarations
00048 // ===========================================================================
00049 class NBLoadedTLDef;
00050 class NBEdgeCont;
00051 
00052 class NIVissimTL {
00053 public:
00054     NIVissimTL(int id, const std::string& type, const std::string& name,
00055                SUMOTime absdur, SUMOTime offset);
00056     ~NIVissimTL();
00057 //    void computeBounding();
00058     std::string getType() const;
00059     int getID() const;
00060 
00061 public:
00062     static bool dictionary(int id, const std::string& type,
00063                            const std::string& name, SUMOTime absdur, SUMOTime offset);
00064     static bool dictionary(int id, NIVissimTL* o);
00065     static NIVissimTL* dictionary(int id);
00066 //    static IntVector getWithin(const AbstractPoly &poly, SUMOReal offset);
00067     static void clearDict();
00068     static bool dict_SetSignals(NBTrafficLightLogicCont& tlc,
00069                                 NBEdgeCont& ec);
00070 
00071 public:
00072     class NIVissimTLSignal;
00073     class NIVissimTLSignalGroup;
00074     typedef std::map<int, NIVissimTLSignal*> SSignalDictType;
00075     typedef std::map<int, NIVissimTLSignalGroup*> SGroupDictType;
00076     typedef std::map<int, SSignalDictType> SignalDictType;
00077     typedef std::map<int, SGroupDictType> GroupDictType;
00078 
00082     class NIVissimTLSignal {
00083     public:
00084         NIVissimTLSignal(int lsaid, int id, const std::string& name,
00085                          const IntVector& groupids, int edgeid, int laneno,
00086                          SUMOReal position, const IntVector& assignedVehicleTypes);
00087         ~NIVissimTLSignal();
00088         bool isWithin(const PositionVector& poly) const;
00089         Position getPosition() const;
00090         bool addTo(NBEdgeCont& ec, NBLoadedTLDef* node) const;
00091 
00092     public:
00093         static bool dictionary(int lsaid, int id, NIVissimTLSignal* o);
00094         static NIVissimTLSignal* dictionary(int lsaid, int id);
00095         static void clearDict();
00096         static SSignalDictType getSignalsFor(int tlid);
00097 
00098     protected:
00099         int myLSA;
00100         int myID;
00101         std::string myName;
00102         IntVector myGroupIDs;
00103         int myEdgeID;
00104         int myLane;
00105         SUMOReal myPosition;
00106         IntVector myVehicleTypes;
00107         static SignalDictType myDict;
00108     };
00109 
00110     class NIVissimTLSignalGroup {
00111     public:
00112         NIVissimTLSignalGroup(int lsaid, int id, const std::string& name,
00113                               bool isGreenBegin, const DoubleVector& times,
00114                               SUMOTime tredyellow, SUMOTime tyellow);
00115         ~NIVissimTLSignalGroup();
00116         bool addTo(NBLoadedTLDef* node) const;
00117     public:
00118         static bool dictionary(int lsaid, int id, NIVissimTLSignalGroup* o);
00119         static NIVissimTLSignalGroup* dictionary(int lsaid, int id);
00120         static void clearDict();
00121         static SGroupDictType getGroupsFor(int tlid);
00122 
00123     private:
00124         int myLSA;
00125         int myID;
00126         std::string myName;
00127         DoubleVector myTimes;
00128         bool myFirstIsRed;
00129         SUMOTime myTRedYellow, myTYellow;
00130         static GroupDictType myDict;
00131     };
00132 
00133 protected:
00134     int myID;
00135     std::string myName;
00136     SUMOTime myAbsDuration;
00137     SUMOTime myOffset;
00138     NIVissimTLSignalGroup* myCurrentGroup;
00139     std::string myType;
00140 private:
00141     typedef std::map<int, NIVissimTL*> DictType;
00142     static DictType myDict;
00143 };
00144 
00145 
00146 #endif
00147 
00148 /****************************************************************************/
00149 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines