Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUITransportableControl.cpp
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2012-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GUITransportableControl.cpp
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @date Wed, 13.06.2012
19
///
20
// GUI-version of the person control for building gui persons
21
/****************************************************************************/
22
#include <config.h>
23
24
#include <vector>
25
#include <algorithm>
26
#include "GUINet.h"
27
#include "GUIContainer.h"
28
#include "GUIPerson.h"
29
#include "GUITransportableControl.h"
30
31
32
// ===========================================================================
33
// method definitions
34
// ===========================================================================
35
GUITransportableControl::GUITransportableControl(const bool isPerson) :
36
MSTransportableControl(isPerson),
37
myIsPerson(isPerson)
38
{}
39
40
41
GUITransportableControl::~GUITransportableControl() {
42
}
43
44
45
MSTransportable*
46
GUITransportableControl::buildPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan,
47
SumoRNG* rng) const {
48
const double speedFactor = vtype->computeChosenSpeedDeviation(rng);
49
return new GUIPerson(pars, vtype, plan, speedFactor);
50
}
51
52
53
MSTransportable*
54
GUITransportableControl::buildContainer(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan) const {
55
return new GUIContainer(pars, vtype, plan);
56
}
57
58
59
void
60
GUITransportableControl::insertIDs(std::vector<GUIGlID>& into) {
61
into.reserve(myTransportables.size());
62
for (std::map<std::string, MSTransportable*>::const_iterator it = myTransportables.begin(); it != myTransportables.end(); ++it) {
63
if (it->second->getCurrentStageType() != MSStageType::WAITING_FOR_DEPART) {
64
if (myIsPerson) {
65
into.push_back(static_cast<const GUIPerson*>(it->second)->getGlID());
66
} else {
67
into.push_back(static_cast<const GUIContainer*>(it->second)->getGlID());
68
}
69
}
70
}
71
}
72
73
74
/****************************************************************************/
75
76