Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNECalibrator.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 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/****************************************************************************/
18//
19/****************************************************************************/
20#include <netedit/GNENet.h>
21#include <netedit/GNEUndoList.h>
22#include <netedit/GNEViewNet.h>
28
29#include "GNECalibrator.h"
30
31
32// ===========================================================================
33// member method definitions
34// ===========================================================================
35
37 GNEAdditional("", net, GLO_CALIBRATOR, tag, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "", {}, {}, {}, {}, {}, {}),
38 myPositionOverLane(0),
39 myFrequency(0),
40myJamThreshold(0) {
41 // reset default values
42 resetDefaultValues();
43}
44
45
46GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
47 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
48 GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {}, {}, {}),
49Parameterised(parameters),
50myPositionOverLane(pos),
51myFrequency(frequency),
52myOutput(output),
53myJamThreshold(jamThreshold),
54myVTypes(vTypes) {
55 // update centering boundary without updating grid
56 updateCenteringBoundary(false);
57}
58
59
60GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
61 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
62 const Parameterised::Map& parameters) :
63 GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {routeProbe}, {}, {}),
64Parameterised(parameters),
65myPositionOverLane(pos),
66myFrequency(frequency),
67myOutput(output),
68myJamThreshold(jamThreshold),
69myVTypes(vTypes) {
70 // update centering boundary without updating grid
71 updateCenteringBoundary(false);
72}
73
74
75GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
76 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
77 GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {}, {}, {}),
78Parameterised(parameters),
79myPositionOverLane(pos),
80myFrequency(frequency),
81myOutput(output),
82myJamThreshold(jamThreshold),
83myVTypes(vTypes) {
84 // update centering boundary without updating grid
85 updateCenteringBoundary(false);
86}
87
88
89GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
90 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
91 const Parameterised::Map& parameters) :
92 GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {routeProbe}, {}, {}),
93Parameterised(parameters),
94myPositionOverLane(pos),
95myFrequency(frequency),
96myOutput(output),
97myJamThreshold(jamThreshold),
98myVTypes(vTypes) {
99 // update centering boundary without updating grid
100 updateCenteringBoundary(false);
101}
102
103
105
106
107void
109 // open tag
111 // write parameters
112 device.writeAttr(SUMO_ATTR_ID, getID());
113 if (getParentEdges().size() > 0) {
114 device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
115 }
116 if (getParentLanes().size() > 0) {
117 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
118 }
120 if (time2string(myFrequency) != "1.00") {
122 }
123 if (!myAdditionalName.empty()) {
125 }
126 if (!myOutput.empty()) {
128 }
129 if (getParentAdditionals().size() > 0) {
131 }
132 if (myJamThreshold != 0.5) {
134 }
135 if (myVTypes.size() > 0) {
137 }
138 // write calibrator flows
139 for (const auto& calibratorFlow : getChildAdditionals()) {
140 if (calibratorFlow->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_FLOW) {
141 calibratorFlow->writeAdditional(device);
142 }
143 }
144 // write parameters (Always after children to avoid problems with additionals.xsd)
145 writeParams(device);
146 device.closeTag();
147}
148
149
150bool
152 return true;
153}
154
155
156std::string
158 return "";
159}
160
161
162void
164 // nothing to fix
165}
166
167