SUMO - Simulation of Urban MObility

NIVissimTL.h

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