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 /****************************************************************************/
17 // GUI-version of the person control for building gui persons
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <algorithm>
28 #include "GUINet.h"
29 #include "GUIContainer.h"
30 #include "GUIPerson.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
38 
39 
41 }
42 
43 
46  std::mt19937* rng) const {
47  const double speedFactor = vtype->computeChosenSpeedDeviation(rng);
48  return new GUIPerson(pars, vtype, plan, speedFactor);
49 }
50 
51 
54  return new GUIContainer(pars, vtype, plan);
55 }
56 
57 
58 void
59 GUITransportableControl::insertPersonIDs(std::vector<GUIGlID>& into) {
60  into.reserve(myTransportables.size());
61  for (std::map<std::string, MSTransportable*>::const_iterator it = myTransportables.begin(); it != myTransportables.end(); ++it) {
62  if (it->second->getCurrentStageType() != MSTransportable::WAITING_FOR_DEPART) {
63  into.push_back(static_cast<const GUIPerson*>(it->second)->getGlID());
64  }
65  }
66 }
67 
68 
69 /****************************************************************************/
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
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:53
GUITransportableControl::~GUITransportableControl
virtual ~GUITransportableControl()
destructor
Definition: GUITransportableControl.cpp:40
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
MSTransportable
Definition: MSTransportable.h:59
GUINet.h
MSVehicleType::computeChosenSpeedDeviation
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
Definition: MSVehicleType.cpp:83
GUIContainer
Definition: GUIContainer.h:52
GUITransportableControl::insertPersonIDs
void insertPersonIDs(std::vector< GUIGlID > &into)
Returns the list of all known persons by gl-id.
Definition: GUITransportableControl.cpp:59
GUITransportableControl::GUITransportableControl
GUITransportableControl()
constructor
Definition: GUITransportableControl.cpp:37
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:588
GUIPerson
Definition: GUIPerson.h:54
config.h
MSTransportableControl::myTransportables
std::map< std::string, MSTransportable * > myTransportables
all currently created transportables by id
Definition: MSTransportableControl.h:210
MSTransportable::WAITING_FOR_DEPART
Definition: MSTransportable.h:62
GUITransportableControl::buildPerson
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, std::mt19937 *rng) const
Builds a new person.
Definition: GUITransportableControl.cpp:45