Eclipse SUMO - Simulation of Urban MObility
GUITransportableControl.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // GUI-version of the person control for building gui persons
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <vector>
26 #include <algorithm>
27 #include "GUINet.h"
28 #include "GUIContainer.h"
29 #include "GUIPerson.h"
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
37 
38 
40 }
41 
42 
45  std::mt19937* rng) const {
46  const double speedFactor = vtype->computeChosenSpeedDeviation(rng);
47  return new GUIPerson(pars, vtype, plan, speedFactor);
48 }
49 
50 
53  return new GUIContainer(pars, vtype, plan);
54 }
55 
56 
57 void
58 GUITransportableControl::insertPersonIDs(std::vector<GUIGlID>& into) {
59  into.reserve(myTransportables.size());
60  for (std::map<std::string, MSTransportable*>::const_iterator it = myTransportables.begin(); it != myTransportables.end(); ++it) {
61  if (it->second->getCurrentStageType() != MSTransportable::WAITING_FOR_DEPART) {
62  into.push_back(static_cast<const GUIPerson*>(it->second)->getGlID());
63  }
64  }
65 }
66 
67 
68 /****************************************************************************/
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
GUITransportableControl.h
GUIContainer.h
GUIPerson.h
GUITransportableControl::buildContainer
virtual MSTransportable * buildContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new container.
Definition: GUITransportableControl.cpp:52
GUITransportableControl::~GUITransportableControl
virtual ~GUITransportableControl()
destructor
Definition: GUITransportableControl.cpp:39
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
MSTransportable
Definition: MSTransportable.h:58
GUINet.h
MSVehicleType::computeChosenSpeedDeviation
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
Definition: MSVehicleType.cpp:82
GUIContainer
Definition: GUIContainer.h:51
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GUITransportableControl::insertPersonIDs
void insertPersonIDs(std::vector< GUIGlID > &into)
Returns the list of all known persons by gl-id.
Definition: GUITransportableControl.cpp:58
GUITransportableControl::GUITransportableControl
GUITransportableControl()
constructor
Definition: GUITransportableControl.cpp:36
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:587
GUIPerson
Definition: GUIPerson.h:53
config.h
MSTransportableControl::myTransportables
std::map< std::string, MSTransportable * > myTransportables
all currently created transportables by id
Definition: MSTransportableControl.h:209
MSTransportable::WAITING_FOR_DEPART
@ WAITING_FOR_DEPART
Definition: MSTransportable.h:61
GUITransportableControl::buildPerson
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, std::mt19937 *rng) const
Builds a new person.
Definition: GUITransportableControl.cpp:44