NIVisumTL.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Intermediate class for storing visum traffic lights during their import
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 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 NIVisumTL_h
00020 #define NIVisumTL_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 #include <vector>
00033 #include <map>
00034 #include <string>
00035 #include <netbuild/NBConnectionDefs.h>
00036 #include <netbuild/NBNodeCont.h>
00037 #include <utils/common/SUMOTime.h>
00038 
00039 class NBTrafficLightLogicCont;
00040 
00041 
00042 // ===========================================================================
00043 // class declaration
00044 // ===========================================================================
00049 class NIVisumTL {
00050 public:
00052     class TimePeriod {
00053     public:
00054         // constructor
00055         TimePeriod();
00056         TimePeriod(SUMOTime StartTime, SUMOTime EndTime);
00057         // destructor
00058         ~TimePeriod();
00059         void SetStartTime(SUMOTime StartTime);
00060         void SetEndTime(SUMOTime EndTime);
00061         SUMOTime GetStartTime();
00062         SUMOTime GetEndTime();
00063     private:
00064         SUMOTime myStartTime;
00065         SUMOTime myEndTime;
00066     };
00067 
00068     // phase
00069     class Phase : public TimePeriod {
00070     public:
00071         Phase();
00072         Phase(SUMOTime StartTime, SUMOTime EndTime);
00073         ~Phase();
00074     };
00075 
00076     // Vectors
00077     typedef std::vector<NBNode*> NodeVector;
00078     typedef std::map<std::string, Phase*> PhaseMap;
00079 
00080     // SignalGroup
00081     // a Signal Group can be defined either by a time period or by phases
00082     class SignalGroup : public TimePeriod {
00083     public:
00084         // constructor
00085         SignalGroup(const std::string &Name, SUMOTime StartTime, SUMOTime EndTime);
00086         // destructor
00087         ~SignalGroup();
00088     private:
00089         NBConnectionVector myConnections;
00090         PhaseMap myPhases;
00091         std::string myName;
00092     public:
00093         NBConnectionVector* GetConnections();
00094         PhaseMap* GetPhases();
00095         std::string GetName();
00096     };
00097 
00098     // SignalGroupVector
00099     typedef std::map<std::string, SignalGroup*> SignalGroupMap;
00100 public:
00101     // constructor
00102     NIVisumTL();
00103     NIVisumTL(const std::string &Name, SUMOTime CycleTime, SUMOTime IntermediateTime,
00104               bool PhaseDefined);
00105     // destructor
00106     ~NIVisumTL();
00107     // nodes and phases
00108     NodeVector* GetNodes();
00109     PhaseMap* GetPhases();
00110     SignalGroupMap* GetSignalGroups();
00111     // set
00112     void SetPhaseDefined(bool PhaseDefined);
00113     void SetCycleTime(SUMOTime CylcleTime);
00114     void SetIntermediateTime(SUMOTime IntermediateTime);
00115     // get
00116     bool GetPhaseDefined();
00117     SUMOTime GetCycleTime();
00118     SUMOTime GetIntermediateTime();
00119     SUMOTime GetName();
00120     SignalGroup* GetSignalGroup(const std::string Name);
00121     // add
00122     void AddSignalGroup(const std::string Name, SUMOTime StartTime, SUMOTime EndTime);
00123     void AddPhase(const std::string Name, SUMOTime StartTime, SUMOTime EndTime);
00124     // build the trafficlight
00125     void build(NBTrafficLightLogicCont &tlc);
00126 private:
00127     // name of traffic light
00128     std::string myName;
00129 
00130     // cycle time of traffic light in seconds
00131     SUMOTime myCycleTime;
00132 
00133     // length of yellow and red-yellow phases
00134     SUMOTime myIntermediateTime;
00135 
00136     // toogles the usage either of phases or of timeperiods in signalgroups
00137     bool myPhaseDefined;
00138 
00139     // vector of nodes belonging to this traffic light
00140     NodeVector myNodes;
00141 
00142     // vector of used phases if phasedefined
00143     PhaseMap myPhases;
00144 
00145     // vector of used Signalgroups
00146     SignalGroupMap mySignalGroups;
00147 
00148 };
00149 
00150 
00151 #endif
00152 
00153 /****************************************************************************/
00154 

Generated on Wed May 5 00:06:34 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6