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-2018 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 /****************************************************************************/
virtual ~GUITransportableControl()
destructor
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, std::mt19937 *rng) const
Builds a new person.
std::map< std::string, MSTransportable * > myTransportables
all currently created transportables by id
virtual MSTransportable * buildContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new container.
The car-following model and parameter.
Definition: MSVehicleType.h:66
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
void insertPersonIDs(std::vector< GUIGlID > &into)
Returns the list of all known persons by gl-id.
Structure representing possible vehicle parameter.
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.