NIVisumTL Class Reference

#include <NIVisumTL.h>


Detailed Description

Intermediate class for storing visum traffic lights during their import.

Definition at line 49 of file NIVisumTL.h.


Public Types

typedef std::vector< NBNode * > NodeVector
typedef std::map< std::string,
Phase * > 
PhaseMap
typedef std::map< std::string,
SignalGroup * > 
SignalGroupMap

Public Member Functions

void AddPhase (const std::string Name, SUMOTime StartTime, SUMOTime EndTime)
void AddSignalGroup (const std::string Name, SUMOTime StartTime, SUMOTime EndTime)
void build (NBTrafficLightLogicCont &tlc)
SUMOTime GetCycleTime ()
SUMOTime GetIntermediateTime ()
SUMOTime GetName ()
NodeVectorGetNodes ()
bool GetPhaseDefined ()
PhaseMapGetPhases ()
SignalGroupGetSignalGroup (const std::string Name)
SignalGroupMapGetSignalGroups ()
 NIVisumTL (const std::string &Name, SUMOTime CycleTime, SUMOTime IntermediateTime, bool PhaseDefined)
 NIVisumTL ()
void SetCycleTime (SUMOTime CylcleTime)
void SetIntermediateTime (SUMOTime IntermediateTime)
void SetPhaseDefined (bool PhaseDefined)
 ~NIVisumTL ()

Private Attributes

SUMOTime myCycleTime
SUMOTime myIntermediateTime
std::string myName
NodeVector myNodes
bool myPhaseDefined
PhaseMap myPhases
SignalGroupMap mySignalGroups

Data Structures

class  Phase
class  SignalGroup
class  TimePeriod
 Timeperiod with starttime and endtime. More...

Member Typedef Documentation

typedef std::vector<NBNode*> NIVisumTL::NodeVector

Definition at line 77 of file NIVisumTL.h.

typedef std::map<std::string, Phase*> NIVisumTL::PhaseMap

Definition at line 78 of file NIVisumTL.h.

typedef std::map<std::string, SignalGroup*> NIVisumTL::SignalGroupMap

Definition at line 99 of file NIVisumTL.h.


Constructor & Destructor Documentation

NIVisumTL::NIVisumTL (  ) 

Definition at line 124 of file NIVisumTL.cpp.

00124 {}

NIVisumTL::NIVisumTL ( const std::string &  Name,
SUMOTime  CycleTime,
SUMOTime  IntermediateTime,
bool  PhaseDefined 
)

Definition at line 127 of file NIVisumTL.cpp.

00129         : myName(Name), myCycleTime(CycleTime), myIntermediateTime(IntermediateTime),
00130         myPhaseDefined(PhaseDefined) {}

NIVisumTL::~NIVisumTL (  ) 

Definition at line 132 of file NIVisumTL.cpp.

References myPhases, and mySignalGroups.

00132                       {
00133     for (NIVisumTL::PhaseMap::iterator i=myPhases.begin();
00134             i!=myPhases.end(); i++) {
00135         delete(i->second);
00136     }
00137     for (NIVisumTL::SignalGroupMap::iterator k=mySignalGroups.begin();
00138             k!=mySignalGroups.end(); k++) {
00139         delete(k->second);
00140     }
00141 }


Member Function Documentation

void NIVisumTL::AddPhase ( const std::string  Name,
SUMOTime  StartTime,
SUMOTime  EndTime 
)

Definition at line 189 of file NIVisumTL.cpp.

References myPhases.

00189                                                                                    {
00190     myPhases[Name] = new NIVisumTL::Phase(StartTime, EndTime);
00191 }

void NIVisumTL::AddSignalGroup ( const std::string  Name,
SUMOTime  StartTime,
SUMOTime  EndTime 
)

Definition at line 185 of file NIVisumTL.cpp.

References mySignalGroups.

00185                                                                                          {
00186     mySignalGroups[Name] = new NIVisumTL::SignalGroup(Name, StartTime, EndTime);
00187 }

void NIVisumTL::build ( NBTrafficLightLogicCont tlc  ) 

Definition at line 198 of file NIVisumTL.cpp.

References NBLoadedTLDef::addSignalGroup(), NBLoadedTLDef::addSignalGroupPhaseBegin(), NBLoadedTLDef::addToSignalGroup(), NIVisumTL::SignalGroup::GetConnections(), NIVisumTL::TimePeriod::GetEndTime(), NBNode::getID(), NIVisumTL::SignalGroup::GetPhases(), NIVisumTL::TimePeriod::GetStartTime(), NBTrafficLightLogicCont::insert(), myCycleTime, myIntermediateTime, myNodes, myPhaseDefined, mySignalGroups, NBLoadedTLDef::setCycleDuration(), NBLoadedTLDef::setSignalYellowTimes(), NBTrafficLightDefinition::TLCOLOR_GREEN, and NBTrafficLightDefinition::TLCOLOR_RED.

00198                                              {
00199     for (NodeVector::iterator ni = myNodes.begin(); ni != myNodes.end(); ni++) {
00200         NBNode *Node = (*ni);
00201         NBLoadedTLDef *def = new NBLoadedTLDef(Node->getID(), Node);
00202         tlc.insert(def);
00203         def->setCycleDuration((unsigned int) myCycleTime);
00204         // signalgroups
00205         for (SignalGroupMap::iterator gi = mySignalGroups.begin(); gi != mySignalGroups.end(); gi++) {
00206             std::string GroupName = (*gi).first;
00207             NIVisumTL::SignalGroup &SG = *(*gi).second;
00208             def->addSignalGroup(GroupName);
00209             def->addToSignalGroup(GroupName, *SG.GetConnections());
00210             def->setSignalYellowTimes(GroupName, myIntermediateTime, myIntermediateTime);
00211             // phases
00212             if (myPhaseDefined) {
00213                 for (PhaseMap::iterator pi = SG.GetPhases()->begin(); pi!= SG.GetPhases()->end(); pi++) {
00214                     NIVisumTL::Phase &PH = *(*pi).second;
00215                     def->addSignalGroupPhaseBegin(GroupName, PH.GetStartTime(), NBTrafficLightDefinition::TLCOLOR_GREEN);
00216                     def->addSignalGroupPhaseBegin(GroupName, PH.GetEndTime(), NBTrafficLightDefinition::TLCOLOR_RED);
00217                 };
00218             } else {
00219                 def->addSignalGroupPhaseBegin(GroupName, SG.GetStartTime(), NBTrafficLightDefinition::TLCOLOR_GREEN);
00220                 def->addSignalGroupPhaseBegin(GroupName, SG.GetEndTime(), NBTrafficLightDefinition::TLCOLOR_RED);
00221             }
00222         }
00223     }
00224 }

SUMOTime NIVisumTL::GetCycleTime (  ) 

Definition at line 144 of file NIVisumTL.cpp.

References myCycleTime.

00144                         {
00145     return myCycleTime;
00146 }

SUMOTime NIVisumTL::GetIntermediateTime (  ) 

Definition at line 149 of file NIVisumTL.cpp.

References myIntermediateTime.

00149                                {
00150     return myIntermediateTime;
00151 }

SUMOTime NIVisumTL::GetName (  ) 

NIVisumTL::NodeVector * NIVisumTL::GetNodes (  ) 

Definition at line 159 of file NIVisumTL.cpp.

References myNodes.

00159                     {
00160     return &myNodes;
00161 }

bool NIVisumTL::GetPhaseDefined (  ) 

Definition at line 154 of file NIVisumTL.cpp.

References myPhaseDefined.

00154                            {
00155     return myPhaseDefined;
00156 }

NIVisumTL::PhaseMap * NIVisumTL::GetPhases (  ) 

Definition at line 165 of file NIVisumTL.cpp.

References myPhases.

Referenced by NIImporter_VISUM::parse_SignalGroupsToPhases().

00165                      {
00166     return &myPhases;
00167 }

NIVisumTL::SignalGroup * NIVisumTL::GetSignalGroup ( const std::string  Name  ) 

Definition at line 193 of file NIVisumTL.cpp.

References mySignalGroups.

Referenced by NIImporter_VISUM::parse_SignalGroupsToPhases().

00193                                                                     {
00194     return (*mySignalGroups.find(Name)).second;
00195 }

NIVisumTL::SignalGroupMap * NIVisumTL::GetSignalGroups (  ) 

Definition at line 169 of file NIVisumTL.cpp.

References mySignalGroups.

00169                                                     {
00170     return &mySignalGroups;
00171 }

void NIVisumTL::SetCycleTime ( SUMOTime  CylcleTime  ) 

Definition at line 173 of file NIVisumTL.cpp.

References myCycleTime.

00173                                                {
00174     myCycleTime = CycleTime;
00175 }

void NIVisumTL::SetIntermediateTime ( SUMOTime  IntermediateTime  ) 

Definition at line 177 of file NIVisumTL.cpp.

References myIntermediateTime.

00177                                                              {
00178     myIntermediateTime = IntermediateTime;
00179 }

void NIVisumTL::SetPhaseDefined ( bool  PhaseDefined  ) 

Definition at line 181 of file NIVisumTL.cpp.

References myPhaseDefined.

00181                                                  {
00182     myPhaseDefined = PhaseDefined;
00183 }


Field Documentation

Definition at line 131 of file NIVisumTL.h.

Referenced by build(), GetCycleTime(), and SetCycleTime().

Definition at line 134 of file NIVisumTL.h.

Referenced by build(), GetIntermediateTime(), and SetIntermediateTime().

std::string NIVisumTL::myName [private]

Definition at line 128 of file NIVisumTL.h.

Definition at line 140 of file NIVisumTL.h.

Referenced by build(), and GetNodes().

Definition at line 137 of file NIVisumTL.h.

Referenced by build(), GetPhaseDefined(), and SetPhaseDefined().

Definition at line 143 of file NIVisumTL.h.

Referenced by AddPhase(), GetPhases(), and ~NIVisumTL().

Definition at line 146 of file NIVisumTL.h.

Referenced by AddSignalGroup(), build(), GetSignalGroup(), GetSignalGroups(), and ~NIVisumTL().


The documentation for this class was generated from the following files:

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