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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // GUI-version of the person control for building gui persons
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <vector>
33 #include <algorithm>
34 #include "GUINet.h"
35 #include "GUIContainer.h"
36 #include "GUIPerson.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
44 
45 
47 }
48 
49 
52  std::mt19937* rng) const {
53  const double speedFactor = vtype->computeChosenSpeedDeviation(rng);
54  return new GUIPerson(pars, vtype, plan, speedFactor);
55 }
56 
57 
60  return new GUIContainer(pars, vtype, plan);
61 }
62 
63 
64 void
65 GUITransportableControl::insertPersonIDs(std::vector<GUIGlID>& into) {
66  into.reserve(myTransportables.size());
67  for (std::map<std::string, MSTransportable*>::const_iterator it = myTransportables.begin(); it != myTransportables.end(); ++it) {
68  if (it->second->getCurrentStageType() != MSTransportable::WAITING_FOR_DEPART) {
69  into.push_back(static_cast<const GUIPerson*>(it->second)->getGlID());
70  }
71  }
72 }
73 
74 
75 /****************************************************************************/
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:72
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.