45std::vector<std::string>
46LaneArea::getIDList() {
47 std::vector<std::string> ids;
54LaneArea::getIDCount() {
55 std::vector<std::string> ids;
61LaneArea::getJamLengthVehicle(
const std::string& detID) {
62 return getDetector(detID)->getCurrentJamLengthInVehicles();
67LaneArea::getJamLengthMeters(
const std::string& detID) {
68 return getDetector(detID)->getCurrentJamLengthInMeters();
73LaneArea::getLastStepMeanSpeed(
const std::string& detID) {
74 return getDetector(detID)->getCurrentMeanSpeed();
78std::vector<std::string>
79LaneArea::getLastStepVehicleIDs(
const std::string& detID) {
80 return getDetector(detID)->getCurrentVehicleIDs();
85LaneArea::getLastStepOccupancy(
const std::string& detID) {
86 return getDetector(detID)->getCurrentOccupancy();
91LaneArea::getPosition(
const std::string& detID) {
92 return getDetector(detID)->getStartPos();
97LaneArea::getLaneID(
const std::string& detID) {
98 return getDetector(detID)->getLane()->getID();
103LaneArea::getLength(
const std::string& detID) {
110LaneArea::getLastStepVehicleNumber(
const std::string& detID) {
111 return getDetector(detID)->getCurrentVehicleNumber();
116LaneArea::getLastStepHaltingNumber(
const std::string& detID) {
117 return getDetector(detID)->getCurrentHaltingNumber();
122LaneArea::getIntervalOccupancy(
const std::string& detID) {
123 return getDetector(detID)->getIntervalOccupancy();
127LaneArea::getIntervalMeanSpeed(
const std::string& detID) {
128 return getDetector(detID)->getIntervalMeanSpeed();
132LaneArea::getIntervalMaxJamLengthInMeters(
const std::string& detID) {
133 return getDetector(detID)->getIntervalMaxJamLengthInMeters();
137LaneArea::getIntervalVehicleNumber(
const std::string& detID) {
138 return getDetector(detID)->getIntervalVehicleNumber();
142LaneArea::getLastIntervalOccupancy(
const std::string& detID) {
143 return getDetector(detID)->getLastIntervalOccupancy();
147LaneArea::getLastIntervalMeanSpeed(
const std::string& detID) {
148 return getDetector(detID)->getLastIntervalMeanSpeed();
152LaneArea::getLastIntervalMaxJamLengthInMeters(
const std::string& detID) {
153 return getDetector(detID)->getLastIntervalMaxJamLengthInMeters();
157LaneArea::getLastIntervalVehicleNumber(
const std::string& detID) {
158 return getDetector(detID)->getLastIntervalVehicleNumber();
163LaneArea::getParameter(
const std::string& detID,
const std::string& param) {
164 return getDetector(detID)->getParameter(param,
"");
172LaneArea::setParameter(
const std::string& detID,
const std::string& name,
const std::string& value) {
173 getDetector(detID)->setParameter(name, value);
181LaneArea::getDetector(
const std::string&
id) {
184 throw TraCIException(
"Lane area detector '" +
id +
"' is not known");
192 if (myTree ==
nullptr) {
194 for (
const std::string&
id : getIDList()) {
196 storeShape(
id, shape);
198 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
199 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
200 myTree->Insert(cmin, cmax, getDetector(
id));
218 shape.push_back(det->
getLanes().back()->getShape().positionAtOffset(det->
getEndPos()));
222std::shared_ptr<VariableWrapper>
223LaneArea::makeWrapper() {
224 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
229LaneArea::overrideVehicleNumber(
const std::string& detID,
int vehNum) {
230 getDetector(detID)->overrideVehicleNumber(vehNum);
235LaneArea::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
238 return wrapper->wrapStringList(objID, variable, getIDList());
240 return wrapper->wrapInt(objID, variable, getIDCount());
242 return wrapper->wrapInt(objID, variable, getLastStepVehicleNumber(objID));
244 return wrapper->wrapDouble(objID, variable, getLastStepMeanSpeed(objID));
246 return wrapper->wrapStringList(objID, variable, getLastStepVehicleIDs(objID));
248 return wrapper->wrapInt(objID, variable, getLastStepHaltingNumber(objID));
250 return wrapper->wrapInt(objID, variable, getJamLengthVehicle(objID));
252 return wrapper->wrapDouble(objID, variable, getJamLengthMeters(objID));
254 return wrapper->wrapDouble(objID, variable, getLastStepOccupancy(objID));
256 return wrapper->wrapDouble(objID, variable, getPosition(objID));
258 return wrapper->wrapString(objID, variable, getLaneID(objID));
260 return wrapper->wrapDouble(objID, variable, getLength(objID));
262 return wrapper->wrapDouble(objID, variable, getIntervalOccupancy(objID));
264 return wrapper->wrapDouble(objID, variable, getIntervalMeanSpeed(objID));
266 return wrapper->wrapDouble(objID, variable, getIntervalMaxJamLengthInMeters(objID));
268 return wrapper->wrapInt(objID, variable, getIntervalVehicleNumber(objID));
270 return wrapper->wrapDouble(objID, variable, getLastIntervalOccupancy(objID));
272 return wrapper->wrapDouble(objID, variable, getLastIntervalMeanSpeed(objID));
274 return wrapper->wrapDouble(objID, variable, getLastIntervalMaxJamLengthInMeters(objID));
276 return wrapper->wrapInt(objID, variable, getLastIntervalVehicleNumber(objID));
279 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
282 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
A class that stores a 2D geometrical boundary.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
C++ TraCI client API implementation.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
An areal detector corresponding to a sequence of consecutive lanes.
std::vector< MSLane * > getLanes()
Returns a vector containing pointers to the lanes covered by the detector ordered from its first to i...
double getStartPos() const
Returns the begin position of the detector.
double getEndPos() const
Returns the end position of the detector.
double getLength() const
Returns the length of the detector.
MSDetectorControl & getDetectorControl()
Returns the detector control.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
T get(const std::string &id) const
Retrieves an item.
void insertIDs(std::vector< std::string > &into) const
int size() const
Returns the number of stored items within the container.
A RT-tree for efficient storing of SUMO's Named objects.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int LAST_STEP_VEHICLE_ID_LIST
TRACI_CONST int VAR_INTERVAL_NUMBER
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_LAST_INTERVAL_NUMBER
TRACI_CONST int VAR_LAST_INTERVAL_MAX_JAM_LENGTH_METERS
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_INTERVAL_MAX_JAM_LENGTH_METERS
TRACI_CONST int VAR_POSITION
TRACI_CONST int LAST_STEP_MEAN_SPEED
TRACI_CONST int VAR_LAST_INTERVAL_OCCUPANCY
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int JAM_LENGTH_METERS
TRACI_CONST int LAST_STEP_VEHICLE_HALTING_NUMBER
TRACI_CONST int VAR_LENGTH
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_LANE_ID
TRACI_CONST int LAST_STEP_OCCUPANCY
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_INTERVAL_SPEED
TRACI_CONST int VAR_LAST_INTERVAL_SPEED
TRACI_CONST int VAR_INTERVAL_OCCUPANCY
TRACI_CONST int JAM_LENGTH_VEHICLE