本文整理汇总了C++中NBNode::getCrossing方法的典型用法代码示例。如果您正苦于以下问题:C++ NBNode::getCrossing方法的具体用法?C++ NBNode::getCrossing怎么用?C++ NBNode::getCrossing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBNode
的用法示例。
在下文中一共展示了NBNode::getCrossing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toString
//.........这里部分代码省略.........
for (EdgeSet::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
roundaboutNodes.insert((*j)->getToNode());
}
}
}
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
const bool checkLaneFoes = checkLaneFoesAll || (checkLaneFoesRoundabout && roundaboutNodes.count((*i).second) > 0);
writeJunction(device, *(*i).second, checkLaneFoes);
}
device.lf();
const bool includeInternal = !oc.getBool("no-internal-links");
if (includeInternal) {
// ... internal nodes if not unwanted
bool hadAny = false;
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
hadAny |= writeInternalNodes(device, *(*i).second);
}
if (hadAny) {
device.lf();
}
}
// write the successors of lanes
unsigned int numConnections = 0;
for (std::map<std::string, NBEdge*>::const_iterator it_edge = ec.begin(); it_edge != ec.end(); it_edge++) {
NBEdge* from = it_edge->second;
from->sortOutgoingConnectionsByIndex();
const std::vector<NBEdge::Connection> connections = from->getConnections();
numConnections += (unsigned int)connections.size();
for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
writeConnection(device, *from, *it_c, includeInternal);
}
}
if (numConnections > 0) {
device.lf();
}
if (includeInternal) {
// ... internal successors if not unwanted
bool hadAny = false;
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
hadAny |= writeInternalConnections(device, *(*i).second);
}
if (hadAny) {
device.lf();
}
}
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
NBNode* node = (*i).second;
// write connections from pedestrian crossings
const std::vector<NBNode::Crossing>& crossings = node->getCrossings();
for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
NWWriter_SUMO::writeInternalConnection(device, (*it).id, (*it).nextWalkingArea, 0, 0, "");
}
// write connections from pedestrian walking areas
const std::vector<NBNode::WalkingArea>& WalkingAreas = node->getWalkingAreas();
for (std::vector<NBNode::WalkingArea>::const_iterator it = WalkingAreas.begin(); it != WalkingAreas.end(); it++) {
if ((*it).nextCrossing != "") {
const NBNode::Crossing& nextCrossing = node->getCrossing((*it).nextCrossing);
// connection to next crossing (may be tls-controlled)
device.openTag(SUMO_TAG_CONNECTION);
device.writeAttr(SUMO_ATTR_FROM, (*it).id);
device.writeAttr(SUMO_ATTR_TO, (*it).nextCrossing);
device.writeAttr(SUMO_ATTR_FROM_LANE, 0);
device.writeAttr(SUMO_ATTR_TO_LANE, 0);
if (node->isTLControlled()) {
device.writeAttr(SUMO_ATTR_TLID, (*node->getControllingTLS().begin())->getID());
assert(nextCrossing.tlLinkNo >= 0);
device.writeAttr(SUMO_ATTR_TLLINKINDEX, nextCrossing.tlLinkNo);
}
device.writeAttr(SUMO_ATTR_DIR, LINKDIR_STRAIGHT);
device.writeAttr(SUMO_ATTR_STATE, nextCrossing.priority ? LINKSTATE_MAJOR : LINKSTATE_MINOR);
device.closeTag();
}
// optional connections from/to sidewalk
for (std::vector<std::string>::const_iterator it_sw = (*it).nextSidewalks.begin(); it_sw != (*it).nextSidewalks.end(); ++it_sw) {
NWWriter_SUMO::writeInternalConnection(device, (*it).id, (*it_sw), 0, 0, "");
}
for (std::vector<std::string>::const_iterator it_sw = (*it).prevSidewalks.begin(); it_sw != (*it).prevSidewalks.end(); ++it_sw) {
NWWriter_SUMO::writeInternalConnection(device, (*it_sw), (*it).id, 0, 0, "");
}
}
}
// write loaded prohibitions
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
writeProhibitions(device, i->second->getProhibitions());
}
// write roundabout information
writeRoundabouts(device, ec.getRoundabouts(), ec);
// write the districts
for (std::map<std::string, NBDistrict*>::const_iterator i = dc.begin(); i != dc.end(); i++) {
writeDistrict(device, *(*i).second);
}
if (dc.size() != 0) {
device.lf();
}
device.close();
}