SUMO - Simulation of Urban MObility
GNEVariableSpeedSignStep.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <utils/common/ToString.h>
32 
34 #include "GNEVariableSpeedSign.h"
35 
36 
37 // ===========================================================================
38 // member method definitions
39 // ===========================================================================
40 
42  myVariableSpeedSignParent(variableSpeedSignParent),
43  myTime(0),
44  mySpeed(50),
45  myTag(SUMO_TAG_STEP) {
46 }
47 
48 
49 GNEVariableSpeedSignStep::GNEVariableSpeedSignStep(GNEVariableSpeedSign* variableSpeedSignParent, double time, double speed) :
50  myVariableSpeedSignParent(variableSpeedSignParent),
51  myTime(0),
52  mySpeed(50),
54  // use set functions to avid non valid intervals
55  setTime(time);
56  setSpeed(speed);
57 }
58 
59 
61 
62 
66 }
67 
68 
71  return myTag;
72 }
73 
74 
75 double
77  return myTime;
78 }
79 
80 
81 double
83  return mySpeed;
84 }
85 
86 
87 bool
89  if (time >= 0) {
90  myTime = time;
91  return true;
92  } else {
93  return false;
94  }
95 }
96 
97 
98 bool
100  if (speed >= 0) {
101  mySpeed = speed;
102  return true;
103  } else {
104  return false;
105  }
106 }
107 
108 
109 bool
111  return (myTime == variableSpeedSignStep.myTime);
112 }
113 
114 
115 bool
117  return (myTime != variableSpeedSignStep.myTime);
118 }
119 
120 
121 bool
123  return (myTime > variableSpeedSignStep.myTime);
124 }
125 
126 
127 bool
129  return (myTime < variableSpeedSignStep.myTime);
130 }
131 
132 
133 bool
135  return (myTime >= variableSpeedSignStep.myTime);
136 }
137 
138 
139 bool
141  return (myTime <= variableSpeedSignStep.myTime);
142 }
143 /****************************************************************************/
GNEVariableSpeedSign * myVariableSpeedSignParent
pointer to variable speed sign parent
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool operator>=(const GNEVariableSpeedSignStep &variableSpeedSignStep) const
overload operator >=
bool operator>(const GNEVariableSpeedSignStep &variableSpeedSignStep) const
overload operator >
bool operator<(const GNEVariableSpeedSignStep &variableSpeedSignStep) const
overload operator <
double getTime() const
get time
bool operator!=(const GNEVariableSpeedSignStep &variableSpeedSignStep) const
overload operator !=
bool setTime(double time)
set time
SumoXMLTag myTag
XML Tag of a variable speed sign interval.
double mySpeed
speed in this timeStep
double getSpeed() const
get speed
bool operator<=(const GNEVariableSpeedSignStep &variableSpeedSignStep) const
overload operator <=
bool operator==(const GNEVariableSpeedSignStep &variableSpeedSignStep) const
overload operator ==
SumoXMLTag getTag() const
get tag
GNEVariableSpeedSignStep(GNEVariableSpeedSign *variableSpeedSignParent)
default constructor
GNEVariableSpeedSign * getVariableSpeedSignParent() const
get variable speed sign parent
bool setSpeed(double speed)
set speed time
trigger: a step description