54 #include <mesosim/METriggeredCalibrator.h>
57 #ifdef CHECK_MEMORY_LEAKS
59 #endif // CHECK_MEMORY_LEAKS
66 : myHandler(0), myHaveWarnedAboutDeprecatedFriendlyPos(false) {}
87 WRITE_ERROR(
"Unknown edge ('" +
id +
"') referenced in a vaporizer.");
96 WRITE_ERROR(
"A vaporization begin time is negative (edge id='" +
id +
"').");
100 WRITE_ERROR(
"A vaporization ends before it starts (edge id='" +
id +
"').");
119 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
124 std::string file = getFileName(attrs, base,
true);
125 std::string objectid = attrs.getStringReporting(
SUMO_ATTR_LANES,
id.c_str(), ok);
127 throw InvalidArgument(
"The lanes to use within MSLaneSpeedTrigger '" +
id +
"' are not known.");
129 std::vector<MSLane*> lanes;
130 std::vector<std::string> laneIDs;
132 for (std::vector<std::string>::iterator i = laneIDs.begin(); i != laneIDs.end(); ++i) {
135 throw InvalidArgument(
"The lane to use within MSLaneSpeedTrigger '" +
id +
"' is not known.");
137 lanes.push_back(lane);
139 if (lanes.size() == 0) {
140 throw InvalidArgument(
"No lane defined for MSLaneSpeedTrigger '" +
id +
"'.");
157 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
162 MSLane* lane = getLane(attrs,
"bus_stop",
id);
167 WRITE_WARNING(
"Deprecated attribute 'from' or 'to' in description of bus stop '" +
id +
"'.");
168 frompos = attrs.getOptSUMORealReporting(
SUMO_ATTR_FROM,
id.c_str(), ok, 0);
172 myHaveWarnedAboutDeprecatedFriendlyPos =
true;
178 if (!ok || !myHandler->checkStopPos(frompos, topos, lane->
getLength(), 10., friendlyPos)) {
182 std::vector<std::string> lines;
185 buildBusStop(net,
id, lines, lane, frompos, topos);
195 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
200 MSLane* lane = getLane(attrs,
"calibrator",
id);
201 const SUMOReal pos = getPosition(attrs, lane,
"calibrator",
id);
204 std::string file = getFileName(attrs, base,
true);
206 std::string outfile = attrs.getOptStringReporting(
SUMO_ATTR_OUTPUT, 0, ok,
"");
207 METriggeredCalibrator* trigger = buildCalibrator(net,
id, &lane->
getEdge(), pos, file, outfile, freq);
221 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
226 std::string file = getFileName(attrs, base,
true);
227 std::string objectid = attrs.getStringReporting(
SUMO_ATTR_EDGES,
id.c_str(), ok);
229 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
231 std::vector<MSEdge*> edges;
232 std::vector<std::string> edgeIDs;
234 for (std::vector<std::string>::iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
237 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
239 edges.push_back(edge);
241 if (edges.size() == 0) {
242 throw InvalidArgument(
"No edges found for MSTriggeredRerouter '" +
id +
"'.");
245 bool off = attrs.getOptBoolReporting(
SUMO_ATTR_OFF,
id.c_str(), ok,
false);
247 throw InvalidArgument(
"Could not parse MSTriggeredRerouter '" +
id +
"'.");
261 const std::vector<MSLane*> &destLanes,
262 const std::string& file) {
268 METriggeredCalibrator*
269 NLTriggerBuilder::buildCalibrator(
MSNet& net,
const std::string&
id,
271 const std::string& file,
272 const std::string& outfile,
274 return new METriggeredCalibrator(
id, edge, pos, file, outfile, freq);
281 std::vector<MSEdge*> &edges,
282 SUMOReal prob,
const std::string& file,
bool off) {
289 const std::vector<std::string> &lines,
292 if (!net.addBusStop(stop)) {
294 throw InvalidArgument(
"Could not build bus stop '" +
id +
"'; probably declared twice.");
303 const std::string& base,
307 std::string file = attrs.getOptStringReporting(
SUMO_ATTR_FILE, 0, ok,
"");
324 const std::string& tt,
327 std::string objectid = attrs.getStringReporting(
SUMO_ATTR_LANE, tid.c_str(), ok);
330 throw InvalidArgument(
"The lane " + objectid +
" to use within the " + tt +
" '" + tid +
"' is not known.");
339 const std::string& tt,
const std::string& tid)
throw(
InvalidArgument) {
341 myHaveWarnedAboutDeprecatedFriendlyPos =
true;
359 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");