本文整理汇总了C++中MESegment::setEntryBlockTime方法的典型用法代码示例。如果您正苦于以下问题:C++ MESegment::setEntryBlockTime方法的具体用法?C++ MESegment::setEntryBlockTime怎么用?C++ MESegment::setEntryBlockTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MESegment
的用法示例。
在下文中一共展示了MESegment::setEntryBlockTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
MELoop::teleportVehicle(MEVehicle* veh, MESegment* const toSegment) {
const SUMOTime leaveTime = veh->getEventTime();
MESegment* const onSegment = veh->getSegment();
const bool teleporting = (onSegment == 0); // is the vehicle already teleporting?
// try to find a place on the current edge
MESegment* teleSegment = toSegment->getNextSegment();
while (teleSegment != 0 && !teleSegment->hasSpaceFor(veh, leaveTime)) {
// @caution the time to get to the next segment here is ignored XXX
teleSegment = teleSegment->getNextSegment();
}
if (teleSegment != 0) {
if (!teleporting) {
// we managed to teleport in a single jump
WRITE_WARNING("Teleporting vehicle '" + veh->getID() + "'; waited too long, from edge '" + onSegment->getEdge().getID()
+ "':" + toString(onSegment->getIndex())
+ " to edge '" + teleSegment->getEdge().getID()
+ "':" + toString(teleSegment->getIndex())
+ ", time " + time2string(leaveTime) + ".");
MSNet::getInstance()->getVehicleControl().registerTeleportJam();
}
changeSegment(veh, leaveTime, teleSegment, true);
teleSegment->setEntryBlockTime(leaveTime); // teleports should not block normal flow
} else {
// teleport across the current edge and try insertion later
if (!teleporting) {
// announce start of multi-step teleport, arrival will be announced in changeSegment()
WRITE_WARNING("Teleporting vehicle '" + veh->getID() + "'; waited too long, from edge '" + onSegment->getEdge().getID()
+ "':" + toString(onSegment->getIndex()) + ", time " + time2string(leaveTime) + ".");
MSNet::getInstance()->getVehicleControl().registerTeleportJam();
// remove from current segment
onSegment->send(veh, 0, leaveTime);
// mark veh as teleporting
veh->setSegment(0, 0);
}
// @caution microsim uses current travel time teleport duration
const SUMOTime teleArrival = leaveTime + TIME2STEPS(veh->getEdge()->getLength() / veh->getEdge()->getSpeedLimit());
const bool atDest = veh->moveRoutePointer();
if (atDest) {
// teleporting to end of route
changeSegment(veh, teleArrival, 0, true);
} else {
veh->setEventTime(teleArrival);
addLeaderCar(veh, 0);
// teleporting vehicles must react to rerouters
getSegmentForEdge(*veh->getEdge())->addReminders(veh);
veh->activateReminders(MSMoveReminder::NOTIFICATION_JUNCTION);
}
}
}