本文整理汇总了C++中MESegment::writeVehicles方法的典型用法代码示例。如果您正苦于以下问题:C++ MESegment::writeVehicles方法的具体用法?C++ MESegment::writeVehicles怎么用?C++ MESegment::writeVehicles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MESegment
的用法示例。
在下文中一共展示了MESegment::writeVehicles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
MSXMLRawOut::writeEdge(OutputDevice& of, const MSEdge& edge, SUMOTime timestep) {
//en
bool dump = !MSGlobals::gOmitEmptyEdgesOnDump;
if (!dump) {
#ifdef HAVE_INTERNAL
if (MSGlobals::gUseMesoSim) {
MESegment* seg = MSGlobals::gMesoNet->getSegmentForEdge(edge);
while (seg != 0) {
if (seg->getCarNumber() != 0) {
dump = true;
break;
}
seg = seg->getNextSegment();
}
} else {
#endif
const std::vector<MSLane*>& lanes = edge.getLanes();
for (std::vector<MSLane*>::const_iterator lane = lanes.begin(); lane != lanes.end(); ++lane) {
if (((**lane).getVehicleNumber() != 0)) {
dump = true;
break;
}
}
#ifdef HAVE_INTERNAL
}
#endif
}
//en
const std::vector<MSPerson*>& persons = edge.getSortedPersons(timestep);
if (dump || persons.size() > 0) {
of.openTag("edge") << " id=\"" << edge.getID() << "\"";
if (dump) {
#ifdef HAVE_INTERNAL
if (MSGlobals::gUseMesoSim) {
MESegment* seg = MSGlobals::gMesoNet->getSegmentForEdge(edge);
while (seg != 0) {
seg->writeVehicles(of);
seg = seg->getNextSegment();
}
} else {
#endif
const std::vector<MSLane*>& lanes = edge.getLanes();
for (std::vector<MSLane*>::const_iterator lane = lanes.begin(); lane != lanes.end(); ++lane) {
writeLane(of, **lane);
}
#ifdef HAVE_INTERNAL
}
#endif
}
// write persons
for (std::vector<MSPerson*>::const_iterator it_p = persons.begin(); it_p != persons.end(); ++it_p) {
of.openTag(SUMO_TAG_PERSON);
of.writeAttr(SUMO_ATTR_ID, (*it_p)->getID());
of.writeAttr(SUMO_ATTR_POSITION, (*it_p)->getEdgePos());
of.writeAttr(SUMO_ATTR_ANGLE, (*it_p)->getAngle());
of.writeAttr("stage", (*it_p)->getCurrentStageDescription());
of.closeTag();
}
of.closeTag();
}
}